From 37d366478ff5dbcd4b134ba300bb0ba8944b9e4a Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Mon, 23 May 2016 14:18:29 +0200 Subject: [PATCH] change trigger position --- htdocs/commande/class/commande.class.php | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index f89d7d5d5a2..44f14bb09e5 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -464,12 +464,6 @@ class Commande extends CommonOrder } } - if (!$error) { - // Call trigger - $result=$this->call_trigger('ORDER_SETDRAFT',$user); - if ($result < 0) $error++; - } - if (!$error) { $this->statut=self::STATUS_DRAFT; @@ -484,9 +478,20 @@ class Commande extends CommonOrder } } - $this->statut=self::STATUS_DRAFT; - $this->db->commit(); - return 1; + if (!$error) { + // Call trigger + $result=$this->call_trigger('ORDER_SETDRAFT',$user); + if ($result < 0) $error++; + } + + if (!$error) { + $this->statut=self::STATUS_DRAFT; + $this->db->commit(); + return 1; + }else { + $this->db->rollback(); + return -1; + } } else {