diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php index ee260dc076f..93c70bb802d 100644 --- a/htdocs/compta/facture/card-rec.php +++ b/htdocs/compta/facture/card-rec.php @@ -91,7 +91,10 @@ $pagenext = $page + 1; $object = new FactureRec($db); if (($id > 0 || $ref) && $action != 'create' && $action != 'add') { $ret = $object->fetch($id, $ref); - if (!$ret) { + if ($ret < 0) { + dol_print_error($db, $object->error, $object->errors); + exit; + } elseif (! $ret) { setEventMessages($langs->trans("ErrorRecordNotFound"), null, 'errors'); } } @@ -1300,11 +1303,11 @@ if ($action == 'create') { print ''; print ''; if ($object->type != Facture::TYPE_CREDIT_NOTE) { - if ($action == 'editconditions') { - $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->cond_reglement_id, 'cond_reglement_id'); - } else { - $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->cond_reglement_id, 'none'); - } + if ($action == 'editconditions') { + $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->cond_reglement_id, 'cond_reglement_id'); + } else { + $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->cond_reglement_id, 'none'); + } } else { print ' '; }