diff --git a/htdocs/compta/resultat/result.php b/htdocs/compta/resultat/result.php index 635531ab86b..b6ac4c1b33f 100644 --- a/htdocs/compta/resultat/result.php +++ b/htdocs/compta/resultat/result.php @@ -405,6 +405,9 @@ if ($modecompta == 'CREANCES-DETTES') { // Set $cpts with array of accounts in the category/group $cpts = $AccCat->getCptsCat($cat['rowid']); + // We should loop over empty $cpts array, else the category _code_ is used in the formula, which leads to wrong result if the code is a number. + if (empty($cpts)) $cpts[] = array(); + $arrayofaccountforfilter = array(); foreach ($cpts as $i => $cpt) { // Loop on each account. @@ -477,7 +480,7 @@ if ($modecompta == 'CREANCES-DETTES') { // Label of group print '