From 24acc82ca6dd944b7e0c05cfcc21dd1397c211c4 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Fri, 25 Jun 2021 16:40:39 +0200 Subject: [PATCH] NEW get errors on create invoice from clone --- htdocs/compta/facture/card.php | 2 +- htdocs/compta/facture/class/facture.class.php | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 5eaed91db56..b88abc9c6d5 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; } } }