From fad9fe71bc873770f62433d60d46c7476f231ed7 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sat, 6 Sep 2014 14:45:35 +0200 Subject: [PATCH] Sort out type & subtype by Chart of accounts --- htdocs/accountancy/class/accountingaccount.class.php | 4 ++-- htdocs/accountancy/class/html.formventilation.class.php | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index 6e0d16c6d6b..82c3ec3ca10 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -126,8 +126,8 @@ class AccountingAccount if (isset($this->active)) $this->active = trim($this->active); - // Check parameters - // Put here code to add control on parameters values + // Check parameters + // Put here code to add control on parameters values // Insert request $sql = "INSERT INTO " . MAIN_DB_PREFIX . "accountingaccount("; diff --git a/htdocs/accountancy/class/html.formventilation.class.php b/htdocs/accountancy/class/html.formventilation.class.php index 7385219780b..33bb33a2353 100644 --- a/htdocs/accountancy/class/html.formventilation.class.php +++ b/htdocs/accountancy/class/html.formventilation.class.php @@ -166,7 +166,9 @@ class FormVentilation extends Form $out = ''; $sql = "SELECT DISTINCT pcg_type "; - $sql .= " FROM " . MAIN_DB_PREFIX . "accountingaccount "; + $sql .= " FROM " . MAIN_DB_PREFIX . "accountingaccount as aa"; + $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version"; + $sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS; $sql .= " ORDER BY pcg_type"; dol_syslog(get_class($this) . "::select_pcgtype sql=" . $sql, LOG_DEBUG); @@ -220,7 +222,9 @@ class FormVentilation extends Form $out = ''; $sql = "SELECT DISTINCT pcg_subtype "; - $sql .= " FROM " . MAIN_DB_PREFIX . "accountingaccount "; + $sql .= " FROM " . MAIN_DB_PREFIX . "accountingaccount as aa"; + $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version"; + $sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS; $sql .= " ORDER BY pcg_subtype"; dol_syslog(get_class($this) . "::select_pcgsubtype sql=" . $sql, LOG_DEBUG);