fix: count throws an error when parameter is null
At the first connection, $_SESSION['poscart'] is empty or null and when you try to add an item to the cart in cashdesk you got this: Warning: count(): Parameter must be an array or an object that implements Countable in /homepages/35/d523563538/htdocs/clickandbuilds/dolibarr/afds/cashdesk/class/Facturation.class.php on line 145 Warning: Cannot modify header information - headers already sent by (output started at /homepages/35/d523563538/htdocs/clickandbuilds/dolibarr/afds/cashdesk/class/Facturation.class.php:145) in /homepages/35/d523563538/htdocs/clickandbuilds/dolibarr/afds/cashdesk/facturation_verif.php on line 234
This commit is contained in:
parent
fff9b7db9d
commit
cf3364d205
@ -142,7 +142,11 @@ class Facturation
|
||||
$this->montantRemise($montant_remise_ht);
|
||||
|
||||
$newcartarray=$_SESSION['poscart'];
|
||||
$i=count($newcartarray);
|
||||
|
||||
$i = 0;
|
||||
if (!is_null($newcartarray) && !is_empty($newcartarray)) {
|
||||
$i=count($newcartarray);
|
||||
}
|
||||
|
||||
$newcartarray[$i]['id']=$i;
|
||||
$newcartarray[$i]['ref']=$product->ref;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user