Fix error management

This commit is contained in:
Laurent Destailleur 2022-01-09 13:50:10 +01:00
parent eddc2a1a26
commit fcfb6a55f4

View File

@ -2395,18 +2395,23 @@ if ($action == 'create') {
$productstatic = new Product($db); $productstatic = new Product($db);
$object->fetch($id, $ref); $result = $object->fetch($id, $ref);
$result = $object->fetch_thirdparty(); if ($result <= 0) {
if ($result < 0) { $langs->load("errors");
dol_print_error($db); print $langs->trans("ErrorRecordNotFound");
llxFooter();
$db->close();
exit;
} }
$societe = new Fournisseur($db); $result = $object->fetch_thirdparty();
$result = $societe->fetch($object->socid);
if ($result < 0) { if ($result < 0) {
dol_print_error($db); dol_print_error($db, $object->error, $object->errors);
exit;
} }
$societe = $object->thirdparty;
$totalpaye = $object->getSommePaiement(); $totalpaye = $object->getSommePaiement();
$totalcreditnotes = $object->getSumCreditNotesUsed(); $totalcreditnotes = $object->getSumCreditNotesUsed();
$totaldeposits = $object->getSumDepositsUsed(); $totaldeposits = $object->getSumDepositsUsed();