diff --git a/htdocs/accountancy/class/accountancycategory.class.php b/htdocs/accountancy/class/accountancycategory.class.php index 5b3282a3b29..a6c9f09c7cb 100644 --- a/htdocs/accountancy/class/accountancycategory.class.php +++ b/htdocs/accountancy/class/accountancycategory.class.php @@ -720,7 +720,7 @@ class AccountancyCategory // extends CommonObject * @param int|array $cpt Accounting account or array of accounting account * @param string $date_start Date start * @param string $date_end Date end - * @param int $sens Sens of the account: 0: credit - debit, 1: debit - credit + * @param int $sens Sens of the account: 0: credit - debit (use this by default), 1: debit - credit * @param string $thirdparty_code Thirdparty code * @param int $month Specifig month - Can be empty * @param int $year Specifig year - Can be empty @@ -805,7 +805,7 @@ class AccountancyCategory // extends CommonObject exit(); } - $sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position, c.category_type"; + $sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position, c.category_type, c.sens"; $sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c"; $sql .= " WHERE c.active = 1"; $sql .= " AND c.entity = " . $conf->entity; @@ -829,7 +829,8 @@ class AccountancyCategory // extends CommonObject 'label' => $obj->label, 'formula' => $obj->formula, 'position' => $obj->position, - 'category_type' => $obj->category_type + 'category_type' => $obj->category_type, + 'bc' => $obj->sens ); $i++; } diff --git a/htdocs/compta/resultat/result.php b/htdocs/compta/resultat/result.php index 16d2631686c..d3ec7082bfb 100644 --- a/htdocs/compta/resultat/result.php +++ b/htdocs/compta/resultat/result.php @@ -405,7 +405,7 @@ elseif ($modecompta=="BOOKKEEPING") // N-1 if (! empty($arrayofaccountforfilter)) { - $return = $AccCat->getSumDebitCredit($arrayofaccountforfilter, $date_start_previous, $date_end_previous, $cpt['dc']?$cpt['dc']:0); + $return = $AccCat->getSumDebitCredit($arrayofaccountforfilter, $date_start_previous, $date_end_previous, $cat['dc']?$cat['dc']:0); if ($return < 0) { setEventMessages(null, $AccCat->errors, 'errors'); @@ -438,7 +438,7 @@ elseif ($modecompta=="BOOKKEEPING") if (($k+1) < $start_month) $yeartoprocess++; //var_dump($monthtoprocess.'_'.$yeartoprocess); - $return = $AccCat->getSumDebitCredit($cpt['account_number'], $date_start, $date_end, $cpt['dc']?$cpt['dc']:0, 'nofilter', $monthtoprocess, $yeartoprocess); + $return = $AccCat->getSumDebitCredit($cpt['account_number'], $date_start, $date_end, $cat['dc']?$cat['dc']:0, 'nofilter', $monthtoprocess, $yeartoprocess); if ($return < 0) { setEventMessages(null, $AccCat->errors, 'errors'); $resultM=0; diff --git a/htdocs/install/mysql/migration/8.0.0-9.0.0.sql b/htdocs/install/mysql/migration/8.0.0-9.0.0.sql index f2a8ca9f380..8e9d82c5fd1 100644 --- a/htdocs/install/mysql/migration/8.0.0-9.0.0.sql +++ b/htdocs/install/mysql/migration/8.0.0-9.0.0.sql @@ -266,6 +266,12 @@ CREATE TABLE llx_pos_cash_fence( UPDATE llx_const set name = 'PRELEVEMENT_END_TO_END' where name = 'END_TO_END'; UPDATE llx_const set name = 'PRELEVEMENT_USTRD' where name = 'USTRD'; +-- Delete duplicate accounting account not used + + ALTER TABLE llx_accounting_account DROP INDEX uk_accounting_account; ALTER TABLE llx_accounting_account ADD UNIQUE INDEX uk_accounting_account (account_number, entity, fk_pcg_version); + + +