From 92686100b23d63c25865e49a4aac01b0d1ad74df Mon Sep 17 00:00:00 2001 From: John BOTELLA Date: Thu, 11 Oct 2018 10:51:54 +0200 Subject: [PATCH] Fix count on no countable object --- htdocs/compta/facture/card.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 8834d93d162..aeb145a7ea2 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3250,8 +3250,7 @@ if ($action == 'create') print '' . $langs->trans($newclassname) . '' . $objectsrc->getNomUrl(1); // We check if Origin document (id and type is known) has already at least one invoice attached to it $objectsrc->fetchObjectLinked($originid,$origin,'','facture'); - $cntinvoice=count($objectsrc->linkedObjects['facture']); - if ($cntinvoice>=1) + if(!empty($objectsrc->linkedObjects['facture']) && is_array($objectsrc->linkedObjects['facture'])) { setEventMessages('WarningBillExist', null, 'warnings'); echo ' ('.$langs->trans('LatestRelatedBill').end($objectsrc->linkedObjects['facture'])->getNomUrl(1).')';