fix 6.0 accountancy multientity

This commit is contained in:
florian HENRY 2018-05-01 12:02:33 +02:00
parent ab85fa8721
commit b5d7206519
3 changed files with 26 additions and 24 deletions

View File

@ -165,6 +165,7 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_vers
if ($db->type == 'pgsql') $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as a2 ON a2.rowid = CAST(aa.account_parent AS INTEGER)"; if ($db->type == 'pgsql') $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as a2 ON a2.rowid = CAST(aa.account_parent AS INTEGER)";
else $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as a2 ON a2.rowid = CAST(aa.account_parent AS UNSIGNED)"; else $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as a2 ON a2.rowid = CAST(aa.account_parent AS UNSIGNED)";
$sql .= " WHERE asy.rowid = " . $pcgver; $sql .= " WHERE asy.rowid = " . $pcgver;
$sql .= " AND aa.entity = " . $conf->entity;
if (strlen(trim($search_account))) $sql .= natural_search("aa.account_number", $search_account); if (strlen(trim($search_account))) $sql .= natural_search("aa.account_number", $search_account);
if (strlen(trim($search_label))) $sql .= natural_search("aa.label", $search_label); if (strlen(trim($search_label))) $sql .= natural_search("aa.label", $search_label);

View File

@ -86,7 +86,7 @@ $tablib[35]= "DictionaryAccountancyJournal";
// Requests to extract data // Requests to extract data
$tabsql=array(); $tabsql=array();
$tabsql[35]= "SELECT a.rowid as rowid, a.code as code, a.label, a.nature, a.active FROM ".MAIN_DB_PREFIX."accounting_journal as a"; $tabsql[35]= "SELECT a.rowid as rowid, a.code as code, a.label, a.nature, a.active FROM ".MAIN_DB_PREFIX."accounting_journal as a WHERE a.entity=".$conf->entity;
// Criteria to sort dictionaries // Criteria to sort dictionaries
$tabsqlsort=array(); $tabsqlsort=array();
@ -102,7 +102,7 @@ $tabfieldvalue[35]= "code,label,nature";
// Nom des champs dans la table pour insertion d'un enregistrement // Nom des champs dans la table pour insertion d'un enregistrement
$tabfieldinsert=array(); $tabfieldinsert=array();
$tabfieldinsert[35]= "code,label,nature"; $tabfieldinsert[35]= "code,label,nature,entity";
// Nom du rowid si le champ n'est pas de type autoincrement // Nom du rowid si le champ n'est pas de type autoincrement
// Example: "" if id field is "rowid" and has autoincrement on // Example: "" if id field is "rowid" and has autoincrement on

View File

@ -273,6 +273,7 @@ class FormAccounting extends Form
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version"; $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 .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS;
$sql .= " AND aa.active = 1"; $sql .= " AND aa.active = 1";
$sql .= " AND aa.entity=".$conf->entity;
$sql .= " ORDER BY aa.account_number"; $sql .= " ORDER BY aa.account_number";
dol_syslog(get_class($this) . "::select_account", LOG_DEBUG); dol_syslog(get_class($this) . "::select_account", LOG_DEBUG);