Fix/accountancy pdf wrong labels (#37153)

* FIX #37147 Limit account fetch to active chart of accounts in PDF exports

When multiple chart of accounts have the same account number, the PDF
exports (balance and ledger) could retrieve the wrong account label.

* FIX #37147 Decode HTML entities in balance PDF account group labels

The balance PDF export was displaying HTML entities (like É) instead
of properly decoded characters (like É) in account group labels.
This commit is contained in:
yveslg 2026-02-08 20:09:40 +01:00 committed by GitHub
parent 9ec77dada2
commit 4951edfbd0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View file

@ -303,7 +303,7 @@ class pdf_balance extends ModelePdfAccountancy
$groupDebit = $groupCredit = $totalDebit = $totalCredit = 0;
for ($i = 0; $i < $nblines; $i++) {
$accountingAccount = new AccountingAccount($this->db);
$accountingAccount->fetch(0, $object->lines[$i]->numero_compte);
$accountingAccount->fetch(0, $object->lines[$i]->numero_compte, true);
// Init the first account group
if (empty($accountGroup)) {
@ -317,7 +317,7 @@ class pdf_balance extends ModelePdfAccountancy
$curY,
$nexY,
$default_font_size,
$langs->trans('Total') . ' ' . $langs->trans('AccountancyGroup' . $accountGroup),
$langs->transnoentitiesnoconv('Total') . ' ' . $langs->transnoentitiesnoconv('AccountancyGroup' . $accountGroup),
$tab_top_newpage,
$groupDebit,
$groupCredit
@ -503,7 +503,7 @@ class pdf_balance extends ModelePdfAccountancy
$curY,
$nexY,
$default_font_size,
$langs->trans('Total') . ' ' . $langs->trans('AccountancyGroup' . $accountingAccount->pcg_type),
$langs->transnoentitiesnoconv('Total') . ' ' . $langs->transnoentitiesnoconv('AccountancyGroup' . $accountingAccount->pcg_type),
$tab_top_newpage,
$groupDebit,
$groupCredit

View file

@ -336,7 +336,7 @@ class pdf_ledger extends ModelePdfAccountancy
} else {
if (empty($account) || $account != $object->lines[$i]->numero_compte) {
$accountingAccount = new AccountingAccount($this->db);
$accountingAccount->fetch(0, $object->lines[$i]->numero_compte);
$accountingAccount->fetch(0, $object->lines[$i]->numero_compte, true);
// Add the subtotal line
if (!empty($account)) {