diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index 1c3b835ad83..a1e69cdc651 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -223,7 +223,7 @@ if ($action=="dl" && $numref > 0) $payment = new Paiement($db); $payment->fetch($val['url_id']); $arraybill = $payment->getBillsArray(); - if (count($arraybill) > 0) + if (is_array($arraybill) && count($arraybill) > 0) { foreach ($arraybill as $billid) { @@ -260,7 +260,7 @@ if ($action=="dl" && $numref > 0) $payment = new PaiementFourn($db); $payment->fetch($val['url_id']); $arraybill = $payment->getBillsArray(); - if (count($arraybill) > 0) + if (is_array($arraybill) && count($arraybill) > 0) { foreach ($arraybill as $billid) { diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 4523326424e..f8dd19ae7e5 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -1052,7 +1052,7 @@ class Paiement extends CommonObject if ($mode == 'withlistofinvoices') { $arraybill = $this->getBillsArray(); - if (count($arraybill) > 0) + if (is_array($arraybill) && count($arraybill) > 0) { require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $facturestatic=new Facture($this->db); diff --git a/scripts/bank/export-bank-receipts.php b/scripts/bank/export-bank-receipts.php index ad70190b689..398ec1d7a19 100755 --- a/scripts/bank/export-bank-receipts.php +++ b/scripts/bank/export-bank-receipts.php @@ -262,7 +262,7 @@ if ($resql) $totalbefore = $total; $total = $total + $objp->amount; - + // Date operation $dateop=$db->jdate($objp->do); @@ -289,22 +289,28 @@ if ($resql) { $paymentstatic->fetch($links[$key]['url_id']); $tmparray=$paymentstatic->getBillsArray(''); - foreach($tmparray as $key => $val) + if (is_array($tmparray)) { - $invoicestatic->fetch($val); - if ($accountelem) $accountelem.= ', '; - $accountelem.=$invoicestatic->ref; + foreach($tmparray as $key => $val) + { + $invoicestatic->fetch($val); + if ($accountelem) $accountelem.= ', '; + $accountelem.=$invoicestatic->ref; + } } } elseif ($links[$key]['type']=='payment_supplier') { $paymentsupplierstatic->fetch($links[$key]['url_id']); $tmparray=$paymentsupplierstatic->getBillsArray(''); - foreach($tmparray as $key => $val) + if (is_array($tmparray)) { - $invoicesupplierstatic->fetch($val); - if ($accountelem) $accountelem.= ', '; - $accountelem.=$invoicesupplierstatic->ref; + foreach($tmparray as $key => $val) + { + $invoicesupplierstatic->fetch($val); + if ($accountelem) $accountelem.= ', '; + $accountelem.=$invoicesupplierstatic->ref; + } } } elseif ($links[$key]['type']=='payment_sc')