Fix: Setting new property of object must be done only after all database

actions are ok (and if ok).
This commit is contained in:
Laurent Destailleur 2014-08-19 15:03:55 +02:00
parent a220634d30
commit 86d91ff698

View File

@ -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
{