From 9e1b8bcd4ca7aa6e53730a9e9147a2ae6cc2e004 Mon Sep 17 00:00:00 2001 From: GregM Date: Thu, 16 Feb 2023 11:33:43 +0100 Subject: [PATCH 1/2] FIX parse error and NAN --- htdocs/compta/resultat/result.php | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/resultat/result.php b/htdocs/compta/resultat/result.php index bf7eee28609..4d2aa61673f 100644 --- a/htdocs/compta/resultat/result.php +++ b/htdocs/compta/resultat/result.php @@ -333,6 +333,9 @@ if ($modecompta == 'CREANCES-DETTES') { // Previous Fiscal year (N-1) foreach ($sommes as $code => $det) { + if (is_null($det['NP'])){ + $det['NP'] = 0; + } $vars[$code] = $det['NP']; } @@ -340,8 +343,11 @@ if ($modecompta == 'CREANCES-DETTES') { //var_dump($result); //$r = $AccCat->calculate($result); + $r = dol_eval($result, 1, 1, '1'); - //var_dump($r); + if (is_nan($r)){ + $r = 0; + } print ''.price($r).''; @@ -360,6 +366,9 @@ if ($modecompta == 'CREANCES-DETTES') { //$r = $AccCat->calculate($result); $r = dol_eval($result, 1, 1, 1); + if (is_nan($r)){ + $r = 0; + } print ''.price($r).''; $sommes[$code]['N'] += $r; @@ -374,6 +383,9 @@ if ($modecompta == 'CREANCES-DETTES') { //$r = $AccCat->calculate($result); $r = dol_eval($result, 1, 1, 1); + if (is_nan($r)){ + $r = 0; + } print ''.price($r).''; $sommes[$code]['M'][$k] += $r; @@ -388,6 +400,9 @@ if ($modecompta == 'CREANCES-DETTES') { //$r = $AccCat->calculate($result); $r = dol_eval($result, 1, 1, 1); + if (is_nan($r)){ + $r = 0; + } print ''.price($r).''; $sommes[$code]['M'][$k] += $r; @@ -416,8 +431,10 @@ if ($modecompta == 'CREANCES-DETTES') { $arrayofaccountforfilter = array(); - foreach ($cpts as $i => $cpt) { // Loop on each account. - $arrayofaccountforfilter[] = $cpt['account_number']; + foreach ($cpts as $i => $cpt) {// Loop on each account. + if (!empty($cpt['account_number'])){ + $arrayofaccountforfilter[] = $cpt['account_number']; + } } // N-1 From 390e7c83b2ae12861b3c43d90da8c8b97174e0a9 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 16 Feb 2023 10:48:41 +0000 Subject: [PATCH 2/2] Fixing style errors. --- htdocs/compta/resultat/result.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/resultat/result.php b/htdocs/compta/resultat/result.php index 4d2aa61673f..1a31c3d7eb1 100644 --- a/htdocs/compta/resultat/result.php +++ b/htdocs/compta/resultat/result.php @@ -333,7 +333,7 @@ if ($modecompta == 'CREANCES-DETTES') { // Previous Fiscal year (N-1) foreach ($sommes as $code => $det) { - if (is_null($det['NP'])){ + if (is_null($det['NP'])) { $det['NP'] = 0; } $vars[$code] = $det['NP']; @@ -345,7 +345,7 @@ if ($modecompta == 'CREANCES-DETTES') { //$r = $AccCat->calculate($result); $r = dol_eval($result, 1, 1, '1'); - if (is_nan($r)){ + if (is_nan($r)) { $r = 0; } @@ -366,7 +366,7 @@ if ($modecompta == 'CREANCES-DETTES') { //$r = $AccCat->calculate($result); $r = dol_eval($result, 1, 1, 1); - if (is_nan($r)){ + if (is_nan($r)) { $r = 0; } @@ -383,7 +383,7 @@ if ($modecompta == 'CREANCES-DETTES') { //$r = $AccCat->calculate($result); $r = dol_eval($result, 1, 1, 1); - if (is_nan($r)){ + if (is_nan($r)) { $r = 0; } @@ -400,7 +400,7 @@ if ($modecompta == 'CREANCES-DETTES') { //$r = $AccCat->calculate($result); $r = dol_eval($result, 1, 1, 1); - if (is_nan($r)){ + if (is_nan($r)) { $r = 0; } @@ -432,7 +432,7 @@ if ($modecompta == 'CREANCES-DETTES') { $arrayofaccountforfilter = array(); foreach ($cpts as $i => $cpt) {// Loop on each account. - if (!empty($cpt['account_number'])){ + if (!empty($cpt['account_number'])) { $arrayofaccountforfilter[] = $cpt['account_number']; } }