From 86d91ff698599b61d63018f5ee0a941fbff83499 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 19 Aug 2014 15:03:55 +0200 Subject: [PATCH] Fix: Setting new property of object must be done only after all database actions are ok (and if ok). --- htdocs/compta/facture/class/facture.class.php | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 9b0e236af35..c46f48ed1c6 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1763,16 +1763,6 @@ class Facture extends CommonInvoice } } - // Set new ref and define current statut - if (! $error) - { - $this->ref = $num; - $this->facnumber=$num; - $this->statut=1; - $this->brouillon=0; - $this->date_validation=$now; - } - // Trigger calls if (! $error) { @@ -1782,6 +1772,16 @@ class Facture extends CommonInvoice //TODO: Restoring ref, facnumber, statut, brouillon to previous value if trigger fail // End call triggers } + + // Set new ref and define current statut + if (! $error) + { + $this->ref = $num; + $this->facnumber=$num; + $this->statut=1; + $this->brouillon=0; + $this->date_validation=$now; + } } else {