FIX #8813
This commit is contained in:
parent
a46362a71f
commit
26e10caa7d
@ -84,7 +84,8 @@ class AccountingAccount extends CommonObject
|
|||||||
* @param int $limittocurrentchart 1=Do not load record if it is into another accounting system
|
* @param int $limittocurrentchart 1=Do not load record if it is into another accounting system
|
||||||
* @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)
|
||||||
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
if ($rowid || $account_number) {
|
if ($rowid || $account_number) {
|
||||||
@ -96,10 +97,10 @@ class AccountingAccount extends CommonObject
|
|||||||
if ($rowid) {
|
if ($rowid) {
|
||||||
$sql .= " a.rowid = '" . $rowid . "'";
|
$sql .= " a.rowid = '" . $rowid . "'";
|
||||||
} elseif ($account_number) {
|
} elseif ($account_number) {
|
||||||
$sql .= " a.account_number = '" . $account_number . "'";
|
$sql .= " a.account_number = '" . $this->db->escape($account_number) . "'";
|
||||||
}
|
}
|
||||||
if (! empty($limittocurrentchart)) {
|
if (! empty($limittocurrentchart)) {
|
||||||
$sql .= ' AND a.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 pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $this->db->escape($conf->global->CHARTOFACCOUNTS) . ')';
|
||||||
}
|
}
|
||||||
|
|
||||||
dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG);
|
dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG);
|
||||||
@ -203,7 +204,7 @@ class AccountingAccount extends CommonObject
|
|||||||
$sql .= ", " . (empty($this->account_number) ? 'NULL' : "'" . $this->db->escape($this->account_number) . "'");
|
$sql .= ", " . (empty($this->account_number) ? 'NULL' : "'" . $this->db->escape($this->account_number) . "'");
|
||||||
$sql .= ", " . (empty($this->account_parent) ? 'NULL' : "'" . $this->db->escape($this->account_parent) . "'");
|
$sql .= ", " . (empty($this->account_parent) ? 'NULL' : "'" . $this->db->escape($this->account_parent) . "'");
|
||||||
$sql .= ", " . (empty($this->label) ? 'NULL' : "'" . $this->db->escape($this->label) . "'");
|
$sql .= ", " . (empty($this->label) ? 'NULL' : "'" . $this->db->escape($this->label) . "'");
|
||||||
$sql .= ", " . (empty($this->account_category) ? 'NULL' : "'" . $this->db->escape($this->account_category) . "'");
|
$sql .= ", " . (empty($this->account_category) ? '0' : $this->db->escape($this->account_category));
|
||||||
$sql .= ", " . $user->id;
|
$sql .= ", " . $user->id;
|
||||||
$sql .= ", " . (! isset($this->active) ? 'NULL' : $this->db->escape($this->active));
|
$sql .= ", " . (! isset($this->active) ? 'NULL' : $this->db->escape($this->active));
|
||||||
$sql .= ")";
|
$sql .= ")";
|
||||||
@ -274,7 +275,7 @@ class AccountingAccount extends CommonObject
|
|||||||
$sql .= " , account_number = '" . $this->db->escape($this->account_number) . "'";
|
$sql .= " , account_number = '" . $this->db->escape($this->account_number) . "'";
|
||||||
$sql .= " , account_parent = '" . $this->db->escape($this->account_parent) . "'";
|
$sql .= " , account_parent = '" . $this->db->escape($this->account_parent) . "'";
|
||||||
$sql .= " , label = " . ($this->label ? "'" . $this->db->escape($this->label) . "'" : "null");
|
$sql .= " , label = " . ($this->label ? "'" . $this->db->escape($this->label) . "'" : "null");
|
||||||
$sql .= " , fk_accounting_category = '" . $this->db->escape($this->account_category) . "'";
|
$sql .= " , fk_accounting_category = " . (empty($this->account_category) ? 0 : $this->db->escape($this->account_category));
|
||||||
$sql .= " , fk_user_modif = " . $user->id;
|
$sql .= " , fk_user_modif = " . $user->id;
|
||||||
$sql .= " , active = " . $this->active;
|
$sql .= " , active = " . $this->active;
|
||||||
$sql .= " WHERE rowid = " . $this->id;
|
$sql .= " WHERE rowid = " . $this->id;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user