diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index e969ae01412..e675ca2a4af 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -2395,18 +2395,23 @@ if ($action == 'create') { $productstatic = new Product($db); - $object->fetch($id, $ref); - $result = $object->fetch_thirdparty(); - if ($result < 0) { - dol_print_error($db); + $result = $object->fetch($id, $ref); + if ($result <= 0) { + $langs->load("errors"); + print $langs->trans("ErrorRecordNotFound"); + llxFooter(); + $db->close(); + exit; } - $societe = new Fournisseur($db); - $result = $societe->fetch($object->socid); + $result = $object->fetch_thirdparty(); if ($result < 0) { - dol_print_error($db); + dol_print_error($db, $object->error, $object->errors); + exit; } + $societe = $object->thirdparty; + $totalpaye = $object->getSommePaiement(); $totalcreditnotes = $object->getSumCreditNotesUsed(); $totaldeposits = $object->getSumDepositsUsed();