From e7cfb719b994c1daf5400c3361790d4d7d4f0d76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Tue, 10 Jun 2014 12:05:31 +0200 Subject: [PATCH] [ bug #1432 ] Trigger SHIPPING_CREATE ignores interception on error --- ChangeLog | 1 + htdocs/expedition/class/expedition.class.php | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index c3a10ce31ae..774b53ac280 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,7 @@ Fix: [ bug #1416 ] Supplier order does not list document models in the select bo supplier order card Fix: [ bug #1443 ] Payment conditions is erased after editing supplier invoice label or limit date for payment +Fix: [ bug #1432 ] Trigger SHIPPING_CREATE ignores interception on error ***** ChangeLog for 3.5.3 compared to 3.5.2 ***** Fix: Error on field accountancy code for export profile of invoices. diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 3f41cdbc07b..e5dbb540b85 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -272,8 +272,22 @@ class Expedition extends CommonObject if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers - $this->db->commit(); - return $this->id; + if (! $error) + { + $this->db->commit(); + return $this->id; + } + else + { + foreach($this->errors as $errmsg) + { + dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; + } + } else {