diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 675653975fc..585cabc1be4 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -193,7 +193,7 @@ if (empty($reshook)) { exit(); } else { $langs->load("errors"); - setEventMessages($object->error, $object->errors, 'errors'); + setEventMessages($objectutil->error, $objectutil->errors, 'errors'); $action = ''; } } elseif ($action == 'reopen' && $usercanreopen) { diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 940cd146f7b..fab10da3751 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1235,14 +1235,20 @@ class Facture extends CommonInvoice $result = $object->create($user); if ($result < 0) { $error++; + $this->error = $object->error; + $this->errors = $object->errors; } else { // copy internal contacts if ($object->copy_linked_contact($this, 'internal') < 0) { $error++; + $this->error = $object->error; + $this->errors = $object->errors; } elseif ($this->socid == $object->socid) { // copy external contacts if same company if ($object->copy_linked_contact($this, 'external') < 0) { $error++; + $this->error = $object->error; + $this->errors = $object->errors; } } }