diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php
index a724cf013eb..ef5fdf5fc21 100644
--- a/htdocs/fourn/facture/card.php
+++ b/htdocs/fourn/facture/card.php
@@ -2085,12 +2085,21 @@ if ($action == 'create')
print '
| '.$txt.' | '.$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, '', 'invoice_supplier');
- $cntinvoice=count($objectsrc->linkedObjects['invoice_supplier']);
- if ($cntinvoice>=1)
+
+ $invoice_supplier = $objectsrc->linkedObjects['invoice_supplier'];
+
+ // count function need a array as argument (Note: the array must implement Countable too)
+ if(is_array($invoice_supplier))
{
- setEventMessages('WarningBillExist', null, 'warnings');
- echo ' ('.$langs->trans('LatestRelatedBill').end($objectsrc->linkedObjects['invoice_supplier'])->getNomUrl(1).')';
+ $cntinvoice = count($invoice_supplier);
+
+ if ($cntinvoice >= 1)
+ {
+ setEventMessages('WarningBillExist', null, 'warnings');
+ echo ' ('.$langs->trans('LatestRelatedBill').end($invoice_supplier)->getNomUrl(1).')';
+ }
}
+
echo ' |
';
print '| '.$langs->trans('AmountHT').' | '.price($objectsrc->total_ht).' |
';
print '| '.$langs->trans('AmountVAT').' | '.price($objectsrc->total_tva)." |
";