diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index 9b0e236af3590b9a0a570698e739759d904b90a9..c46f48ed1c6cee3c19d09a2b1543f5348d9d695d 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
 		{