Add one param to fetch of accounting account to solve chart import
This commit is contained in:
parent
769fbdb429
commit
0fc7ad7c1f
@ -151,10 +151,11 @@ class AccountingAccount extends CommonObject
|
|||||||
*
|
*
|
||||||
* @param int $rowid Id
|
* @param int $rowid Id
|
||||||
* @param string $account_number Account number
|
* @param string $account_number Account number
|
||||||
* @param int $limittocurrentchart 1=Do not load record if it is into another accounting system
|
* @param int|boolean $limittocurrentchart 1 or true=Load record only if it is into current active char of account
|
||||||
|
* @param string $limittochartaccount 'ABC'=Load record only if it is into chart account with code 'ABC'.
|
||||||
* @return int <0 if KO, 0 if not found, Id of record if OK and found
|
* @return int <0 if KO, 0 if not found, Id of record if OK and found
|
||||||
*/
|
*/
|
||||||
function fetch($rowid = null, $account_number = null, $limittocurrentchart = 0)
|
function fetch($rowid = null, $account_number = null, $limittocurrentchart = 0, $limittoachartaccount = '')
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
@ -172,6 +173,9 @@ class AccountingAccount extends CommonObject
|
|||||||
if (! empty($limittocurrentchart)) {
|
if (! empty($limittocurrentchart)) {
|
||||||
$sql .= ' AND a.fk_pcg_version IN (SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $this->db->escape($conf->global->CHARTOFACCOUNTS) . ')';
|
$sql .= ' AND a.fk_pcg_version IN (SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $this->db->escape($conf->global->CHARTOFACCOUNTS) . ')';
|
||||||
}
|
}
|
||||||
|
if (! empty($limittoachartaccount)) {
|
||||||
|
$sql .= " AND a.fk_pcg_version = '".$this->db->escape($limittoachartaccount)."')";
|
||||||
|
}
|
||||||
|
|
||||||
dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG);
|
dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG);
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user