Commit cde7e02d4ac2bee7592d5d0fd98d40033ad51c2e

Authored by aspangaro
1 parent 0e520bb0
Exists in 3.5 and in 1 other branch 3.6

Fix: Filter by chart of accounts

Showing 1 changed file with 13 additions and 8 deletions   Show diff stats
accountingex/class/html.formventilation.class.php
... ... @@ -2,6 +2,7 @@
2 2 /* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
3 3 * Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
4 4 * Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
  5 + * Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
5 6 *
6 7 * This program is free software; you can redistribute it and/or modify
7 8 * it under the terms of the GNU General Public License as published by
... ... @@ -18,8 +19,8 @@
18 19 */
19 20  
20 21 /**
21   - * \file accountingex/class/html.formventilation.class.php
22   - * \brief Class for HML form
  22 + * \file accountingex/class/html.formventilation.class.php
  23 + * \brief Class for HTML form
23 24 */
24 25 class FormVentilation extends Form {
25 26 var $db;
... ... @@ -47,8 +48,8 @@ class FormVentilation extends Form {
47 48  
48 49 $date_array = array ();
49 50  
50   - $sql = 'SELECT DISTINCT import_key from ' . MAIN_DB_PREFIX . 'bookkeeping ';
51   - $sql .= ' ORDER BY import_key DESC';
  51 + $sql = 'SELECT DISTINCT import_key from ' . MAIN_DB_PREFIX . 'bookkeeping ';
  52 + $sql .= 'ORDER BY import_key DESC';
52 53  
53 54 $out = '<SELECT name="' . $htmlname . '">';
54 55  
... ... @@ -154,8 +155,10 @@ class FormVentilation extends Form {
154 155  
155 156 $out = '';
156 157  
157   - $sql = "SELECT DISTINCT pcg_type ";
158   - $sql .= " FROM " . MAIN_DB_PREFIX . "accountingaccount ";
  158 + $sql = "SELECT DISTINCT pcg_type ";
  159 + $sql .= " FROM " . MAIN_DB_PREFIX . "accountingaccount a";
  160 + $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system b ON a.fk_pcg_version=b.pcg_version";
  161 + $sql .= " WHERE b.rowid=".$conf->global->CHARTOFACCOUNTS;
159 162 $sql .= " ORDER BY pcg_type";
160 163  
161 164 dol_syslog(get_class($this) . "::select_pcgtype sql=" . $sql, LOG_DEBUG);
... ... @@ -206,8 +209,10 @@ class FormVentilation extends Form {
206 209  
207 210 $out = '';
208 211  
209   - $sql = "SELECT DISTINCT pcg_subtype ";
210   - $sql .= " FROM " . MAIN_DB_PREFIX . "accountingaccount ";
  212 + $sql = "SELECT DISTINCT pcg_subtype ";
  213 + $sql .= " FROM " . MAIN_DB_PREFIX . "accountingaccount a";
  214 + $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system b ON a.fk_pcg_version=b.pcg_version";
  215 + $sql .= " WHERE b.rowid=".$conf->global->CHARTOFACCOUNTS;
211 216 $sql .= " ORDER BY pcg_subtype";
212 217  
213 218 dol_syslog(get_class($this) . "::select_pcgsubtype sql=" . $sql, LOG_DEBUG);
... ...