Merge pull request #9728 from atm-john/8.0_Fix_count_error

Fix count on no countable object
This commit is contained in:
Laurent Destailleur 2018-10-12 17:52:30 +02:00 committed by GitHub
commit a2aa491c51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3251,8 +3251,7 @@ if ($action == 'create')
print '<tr><td>' . $langs->trans($newclassname) . '</td><td colspan="2">' . $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 (is_array($objectsrc->linkedObjects['facture']) && count($objectsrc->linkedObjects['facture']) >= 1)
{
setEventMessages('WarningBillExist', null, 'warnings');
echo ' ('.$langs->trans('LatestRelatedBill').end($objectsrc->linkedObjects['facture'])->getNomUrl(1).')';