diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index b2bd4a1af93e9fbf1ee231181304aca2e806495f..5a9b5e3788c786ece11e5527b2caaad9b862fe82 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -69,16 +69,16 @@ class AccountingAccount extends CommonObject if ($rowid || $account_number) { $sql = "SELECT a.rowid, a.datec, a.tms, a.fk_pcg_version, a.pcg_type, a.pcg_subtype, a.account_number, a.account_parent, a.label, a.fk_accounting_category, a.fk_user_author, a.fk_user_modif, a.active"; - $sql .= ", ac.label as category_label"; - $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as a, ".MAIN_DB_PREFIX."c_accounting_category as ac"; - $sql .= " WHERE a.fk_accounting_category = ac.rowid"; + $sql .= ", ac.rowid, ac.label as category_label"; + $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as a, " . MAIN_DB_PREFIX . "c_accounting_category as ac"; + $sql .= " WHERE "; if ($rowid) { - $sql .= " AND rowid = '" . $rowid . "'"; + $sql .= " a.rowid = '" . $rowid . "'"; } elseif ($account_number) { - $sql .= " AND account_number = '" . $account_number . "'"; + $sql .= " a.account_number = '" . $account_number . "'"; } if (! empty($limittocurentchart)) { - $sql .= ' AND fk_pcg_version IN (SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS . ')'; + $sql .= ' AND a.fk_pcg_version IN (SELECT a.pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system as as WHERE as.rowid=' . $conf->global->CHARTOFACCOUNTS . ')'; } dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG); $result = $this->db->query($sql); diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index e1fe67518bc26bed0a7d73f6fe12888ed8b29180..d88df512b8cb5665ce625cfd46e18c644e46f7cf 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -80,7 +80,7 @@ $hookmanager->initHooks(array('admin')); // Put here declaration of dictionaries properties // Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this. -$taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,33,34,0,6,0,29,0,7,17,24,28,0,10,23,12,13,0,14,0,22,20,18,21,0,15,30,0,25,0,26,0,31,0); +$taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,33,34,0,6,0,29,0,7,17,24,28,0,10,23,12,13,0,14,0,22,20,18,21,0,15,30,0,25,0,26,0,31,32,0); // Name of SQL tables of dictionaries $tabname=array(); @@ -115,7 +115,7 @@ $tabname[28]= MAIN_DB_PREFIX."c_holiday_types"; $tabname[29]= MAIN_DB_PREFIX."c_lead_status"; $tabname[30]= MAIN_DB_PREFIX."c_format_cards"; $tabname[31]= MAIN_DB_PREFIX."accounting_system"; -$tabname[32]= MAIN_DB_PREFIX."c_accountancy_category"; +$tabname[32]= MAIN_DB_PREFIX."c_accounting_category"; $tabname[33]= MAIN_DB_PREFIX."c_hrm_department"; $tabname[34]= MAIN_DB_PREFIX."c_hrm_function"; @@ -189,7 +189,7 @@ $tabsql[28]= "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.new $tabsql[29]= "SELECT rowid as rowid, code, label, percent, position, active FROM ".MAIN_DB_PREFIX."c_lead_status"; $tabsql[30]= "SELECT rowid, code, name, paper_size, orientation, metric, leftmargin, topmargin, nx, ny, spacex, spacey, width, height, font_size, custom_x, custom_y, active FROM ".MAIN_DB_PREFIX."c_format_cards"; $tabsql[31]= "SELECT s.rowid as rowid, pcg_version, s.fk_pays as country_id, c.code as country_code, c.label as country, s.label, s.active FROM ".MAIN_DB_PREFIX."accounting_system as s, ".MAIN_DB_PREFIX."c_country as c WHERE s.fk_pays=c.rowid and c.active=1"; -$tabsql[32]= "SELECT a.rowid as rowid, a.code as code, a.label, a.range, a.position, a.fk_country as country_id, c.code as country_code, c.label as country, a.active FROM ".MAIN_DB_PREFIX."c_accountancy_category as a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_country=c.rowid and c.active=1"; +$tabsql[32]= "SELECT a.rowid as rowid, a.code as code, a.label, a.range, a.position, a.fk_country as country_id, c.code as country_code, c.label as country, a.active FROM ".MAIN_DB_PREFIX."c_accounting_category as a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_country=c.rowid and c.active=1"; $tabsql[33]= "SELECT rowid, pos, code, label, active FROM ".MAIN_DB_PREFIX."c_hrm_department"; $tabsql[34]= "SELECT rowid, pos, code, label, c_level, active FROM ".MAIN_DB_PREFIX."c_hrm_function"; diff --git a/htdocs/core/class/html.formaccounting.class.php b/htdocs/core/class/html.formaccounting.class.php index 4120a4f74b6a3065827596a486dad2634ca80bf2..dc01907ad1593865acb22240b515a88c15bf478d 100644 --- a/htdocs/core/class/html.formaccounting.class.php +++ b/htdocs/core/class/html.formaccounting.class.php @@ -65,7 +65,7 @@ class FormAccounting if (! empty($mysoc->country_id)) { $sql = "SELECT c.rowid, c.label as type, c.range"; - $sql.= " FROM ".MAIN_DB_PREFIX."c_accountancy_category as c"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c"; $sql.= " WHERE c.active = 1"; $sql.= " AND c.fk_country = ".$mysoc->country_id; $sql.= " ORDER BY c.label ASC"; @@ -73,7 +73,7 @@ class FormAccounting else { $sql = "SELECT c.rowid, c.label as type, c.range"; - $sql.= " FROM ".MAIN_DB_PREFIX."c_accountancy_category, ".MAIN_DB_PREFIX."c_country as co"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c, ".MAIN_DB_PREFIX."c_country as co"; $sql.= " WHERE c.active = 1 AND c.fk_country = co.rowid"; $sql.= " AND co.code = '".$mysoc->country_code."'"; $sql.= " ORDER BY c.label ASC";