2
0
forked from Wavyzz/dolibarr

Merge remote-tracking branch 'upstream/develop' into develop

This commit is contained in:
Alexandre SPANGARO
2019-05-26 14:07:23 +02:00
28 changed files with 171 additions and 953 deletions

View File

@@ -83,13 +83,13 @@ class AccountancySystem
if ($rowid > 0 || $ref)
{
$sql = "SELECT a.pcg_version, a.label, a.active";
$sql = "SELECT a.rowid, a.pcg_version, a.label, a.active";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_system as a";
$sql .= " WHERE";
if ($rowid) {
$sql .= " a.rowid = '" . $rowid . "'";
} elseif ($ref) {
$sql .= " a.pcg_version = '" . $ref . "'";
$sql .= " a.pcg_version = '" . $this->db->escape($ref) . "'";
}
dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG);

View File

@@ -151,12 +151,13 @@ class AccountingAccount extends CommonObject
/**
* Load record in memory
*
* @param int $rowid Id
* @param string $account_number Account number
* @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
* @param int $rowid Id
* @param string $account_number Account number
* @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
*/
public function fetch($rowid = null, $account_number = null, $limittocurrentchart = 0)
public function fetch($rowid = null, $account_number = null, $limittocurrentchart = 0, $limittoachartaccount = '')
{
global $conf;
@@ -174,6 +175,9 @@ class AccountingAccount extends CommonObject
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) . ')';
}
if (! empty($limittoachartaccount)) {
$sql .= " AND a.fk_pcg_version = '".$this->db->escape($limittoachartaccount)."'";
}
dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG);
$result = $this->db->query($sql);