Merge pull request #8702 from atm-florian/6.0
fix accountancy multientity
This commit is contained in:
commit
7bb9615cff
@ -160,10 +160,10 @@ $pcgver = $conf->global->CHARTOFACCOUNTS;
|
|||||||
$sql = "SELECT aa.rowid, aa.fk_pcg_version, aa.pcg_type, aa.pcg_subtype, aa.account_number, aa.account_parent , aa.label, aa.active, ";
|
$sql = "SELECT aa.rowid, aa.fk_pcg_version, aa.pcg_type, aa.pcg_subtype, aa.account_number, aa.account_parent , aa.label, aa.active, ";
|
||||||
$sql .= " a2.rowid as rowid2, a2.label as label2, a2.account_number as account_number2";
|
$sql .= " a2.rowid as rowid2, a2.label as label2, a2.account_number as account_number2";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa";
|
||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version AND aa.entity = " . $conf->entity;
|
||||||
// Dirty hack wainting that foreign key account_parent is an integer to be compared correctly with rowid
|
// Dirty hack wainting that foreign key account_parent is an integer to be compared correctly with rowid
|
||||||
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) AND a2.entity = " . $conf->entity;
|
||||||
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) AND a2.entity = " . $conf->entity;
|
||||||
$sql .= " WHERE asy.rowid = " . $pcgver;
|
$sql .= " WHERE asy.rowid = " . $pcgver;
|
||||||
|
|
||||||
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);
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -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);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user