This commit is contained in:
aspangaro 2016-03-28 15:32:57 +02:00
parent 436fb91901
commit cbecb37c59
2 changed files with 6 additions and 5 deletions

View File

@ -68,18 +68,19 @@ class AccountingAccount extends CommonObject
global $conf;
if ($rowid || $account_number) {
$sql = "SELECT a.rowid, a.datec, a.tms, a.fk_pcg_version, a.pcg_type, a.pcg_subtype, a.account_number, a.account_parent, a.label, a.fk_accounting_category, a.fk_user_author, a.fk_user_modif, a.active";
$sql = "SELECT a.rowid as rowid, a.datec, a.tms, a.fk_pcg_version, a.pcg_type, a.pcg_subtype, a.account_number, a.account_parent, a.label, a.fk_accounting_category, a.fk_user_author, a.fk_user_modif, a.active";
$sql .= ", ac.rowid, ac.label as category_label";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as a, " . MAIN_DB_PREFIX . "c_accounting_category as ac";
$sql .= " WHERE ";
$sql .= " WHERE a.fk_accounting_category = ac.rowid";
if ($rowid) {
$sql .= " a.rowid = '" . $rowid . "'";
$sql .= " AND a.rowid = '" . $rowid . "'";
} elseif ($account_number) {
$sql .= " a.account_number = '" . $account_number . "'";
$sql .= " AND a.account_number = '" . $account_number . "'";
}
if (! empty($limittocurentchart)) {
$sql .= ' AND a.fk_pcg_version IN (SELECT a.pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system as as WHERE as.rowid=' . $conf->global->CHARTOFACCOUNTS . ')';
}
dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG);
$result = $this->db->query($sql);
if ($result) {

View File

@ -52,7 +52,7 @@ class FormAccounting
* @param int $help Add or not the admin help picto
* @return void
*/
function select_accounting_category($selected='',$htmlname='actioncode', $useempty=0, $maxlen=64, $help=1)
function select_accounting_category($selected='',$htmlname='account_category', $useempty=0, $maxlen=64, $help=1)
{
global $db,$langs,$user,$mysoc;