From ce37323f697be20d84d03173238b1e8dbdc680e1 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 13 Oct 2021 14:14:30 +0200 Subject: [PATCH 1/2] FIX avoid non-numeric warning --- htdocs/core/lib/invoice.lib.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php index 193c4c3acb7..7c0dbbd084c 100644 --- a/htdocs/core/lib/invoice.lib.php +++ b/htdocs/core/lib/invoice.lib.php @@ -518,8 +518,10 @@ function getNumberInvoicesPieChart($mode) $dataseries[$i]=array($langs->trans('NbOfOpenInvoices'), $obj->nblate30, $obj->nblate15 - $obj->nblate30, $obj->nblatenow - $obj->nblate15, $obj->nbnotlatenow - $obj->nbnotlate15, $obj->nbnotlate15 - $obj->nbnotlate30, $obj->nbnotlate30); $i++; } - foreach ($dataseries[0] as $key=>$value) { - $total += $value; + if (!empty($dataseries[0])) { + foreach ($dataseries[0] as $key=>$value) { + $total += $value; + } } $legend = array( $langs->trans('InvoiceLate30Days'), From f14de50bd787a932c9a15eced029467322395292 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 13 Oct 2021 14:26:43 +0200 Subject: [PATCH 2/2] FIX check if numeric value --- htdocs/core/lib/invoice.lib.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php index 7c0dbbd084c..573f27c1eee 100644 --- a/htdocs/core/lib/invoice.lib.php +++ b/htdocs/core/lib/invoice.lib.php @@ -519,8 +519,10 @@ function getNumberInvoicesPieChart($mode) $i++; } if (!empty($dataseries[0])) { - foreach ($dataseries[0] as $key=>$value) { - $total += $value; + foreach ($dataseries[0] as $key => $value) { + if (is_numeric($value)) { + $total += $value; + } } } $legend = array(