diff --git a/htdocs/commande/commande.class.php b/htdocs/commande/commande.class.php
index b1a50c550ee18e58ed3de5b9ad7d01be1770de94..924fe36d4707a9ff543d0933c9a2b567050ab6dd 100644
--- a/htdocs/commande/commande.class.php
+++ b/htdocs/commande/commande.class.php
@@ -144,13 +144,14 @@ class Commande extends CommonObject
 		return $this->create($user);
 	}
 
-  /**   \brief      Valide la commande
-        \param      user            Utilisateur qui valide
-   */
+	/**   	\brief      Valide la commande
+	 *    	\param      user        Utilisateur qui valide
+	 *		\return		int			<=0 si ko, >0 si ok
+	 */
 	function valid($user)
 	{
-		$result = 0;
 		global $conf;
+
 		if ($user->rights->commande->valider)
 		{
 			if (defined('COMMANDE_ADDON'))
@@ -158,21 +159,23 @@ class Commande extends CommonObject
 				if (is_readable(DOL_DOCUMENT_ROOT .'/includes/modules/commande/'.COMMANDE_ADDON.'.php'))
 				{
 					require_once DOL_DOCUMENT_ROOT .'/includes/modules/commande/'.COMMANDE_ADDON.'.php';
-
+		
+					$this->db->begin();
+					
 					// Definition du nom de module de numerotation de commande
-
+		
 					// \todo  Normer le nom des classes des modules de num�rotation de ref de commande avec un nom du type NumRefCommandesXxxx
 					//
 					//$list=split('_',COMMANDE_ADDON);
 					//$numrefname=$list[2];
 					//$modName = 'NumRefCommandes'.ucfirst($numrefname);
-					$modName=COMMANDE_ADDON;
-
+					$modName=$conf->global->COMMANDE_ADDON;
+		
 					// Recuperation de la nouvelle reference
 					$objMod = new $modName($this->db);
 					$soc = new Societe($this->db);
 					$soc->fetch($this->socidp);
-					
+		
 					// on v�rifie si la commande est en num�rotation provisoire
 					$comref = substr($this->ref, 1, 4);
 					if ($comref == PROV)
@@ -183,57 +186,71 @@ class Commande extends CommonObject
 					{
 						$num = $this->ref;
 					}
-
+		
 					$sql = 'UPDATE '.MAIN_DB_PREFIX."commande SET ref='$num', fk_statut = 1, date_valid=now(), fk_user_valid=$user->id";
 					$sql .= " WHERE rowid = $this->id AND fk_statut = 0 ;";
-
+		
 					if ($this->db->query($sql) )
 					{
-							// On efface le r�pertoire de pdf provisoire
-							$comref = sanitize_string($this->ref);
-							if ($conf->commande->dir_output)
+						// On efface le r�pertoire de pdf provisoire
+						$comref = sanitize_string($this->ref);
+						if ($conf->commande->dir_output)
+						{
+							$dir = $conf->commande->dir_output . "/" . $comref ;
+							$file = $conf->commande->dir_output . "/" . $comref . "/" . $comref . ".pdf";
+							if (file_exists($file))
 							{
-								$dir = $conf->commande->dir_output . "/" . $comref ;
-								$file = $conf->commande->dir_output . "/" . $comref . "/" . $comref . ".pdf";
-								if (file_exists($file))
+								commande_delete_preview($this->db, $this->id, $this->ref);
+		
+								if (!dol_delete_file($file))
 								{
-									commande_delete_preview($this->db, $this->id, $this->ref);
-									
-									if (!dol_delete_file($file))
-									{
-                    $this->error=$langs->trans("ErrorCanNotDeleteFile",$file);
-                    return 0;
-                  }
-                }
-                if (file_exists($dir))
-                {
-                	if (!dol_delete_dir($dir))
-                  {
-                  	$this->error=$langs->trans("ErrorCanNotDeleteDir",$dir);
-                    return 0;
-                  }
-                }
-               }
-	    			$result = 1;
+									$this->error=$langs->trans("ErrorCanNotDeleteFile",$file);
+					                $this->db->rollback();
+									return 0;
+								}
+							}
+							if (file_exists($dir))
+							{
+								if (!dol_delete_dir($dir))
+								{
+									$this->error=$langs->trans("ErrorCanNotDeleteDir",$dir);
+					                $this->db->rollback();
+									return 0;
+								}
+							}
+						}
+		
+						// Appel des triggers
+						include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
+						$interface=new Interfaces($this->db);
+						$result=$interface->run_triggers('ORDER_VALIDATE',$this,$user,$langs,$conf);
+						// Fin appel triggers
+
+		                $this->db->commit();
+		                return $this->id;
 					}
 					else
 					{
-						$result = -1;
-						dolibarr_print_error($this->db);
+		                $this->db->rollback();
+						$this->error=$this->db->error();
+						return -1;
 					}
-
 				}
 				else
 				{
-					print 'Impossible de lire le module de num�rotation';
+					$this->error='Impossible de lire le module de num�rotation';
+					return -1;
 				}
 			}
 			else
 			{
-				print 'Le module de num�rotation n\'est pas d�fini' ;
+				$this->error='Le module de num�rotation n\'est pas d�fini';
+				return -1;
 			}
 		}
-		return $result ;
+
+		$this->error='Autorisation insuffisante';
+		return -1;
 	}
 	
 	/**
@@ -446,8 +463,14 @@ class Commande extends CommonObject
 							$this->add_contact($this->contactid[0], 'CUSTOMER', 'external');
 						}
 					}
-
-			    $this->db->commit();
+			    	
+	                // Appel des triggers
+	                include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
+	                $interface=new Interfaces($this->db);
+	                $result=$interface->run_triggers('ORDER_CREATE',$this,$user,$langs,$conf);
+	                // Fin appel triggers
+
+			    	$this->db->commit();
 					return $this->id;
 				}
 				else
@@ -1697,61 +1720,69 @@ class Commande extends CommonObject
 	
 
 	/**
-	* Supprime la commande
-	*
-	*/
+	 *		\brief		Supprime la commande
+	 */
 	function delete()
 	{
 		global $conf, $lang;
-		
+	
 		$err = 0;
 		$this->db->begin();
+	
 		$sql = 'DELETE FROM '.MAIN_DB_PREFIX."commandedet WHERE fk_commande = $this->id ;";
 		if (! $this->db->query($sql) )
 		{
 			$err++;
 		}
-
+	
 		$sql = 'DELETE FROM '.MAIN_DB_PREFIX."commande WHERE rowid = $this->id;";
 		if (! $this->db->query($sql) )
 		{
 			$err++;
 		}
-
+	
 		$sql = 'DELETE FROM '.MAIN_DB_PREFIX."co_pr WHERE fk_commande = $this->id;";
 		if (! $this->db->query($sql) )
 		{
 			$err++;
 		}
-		
+	
 		// On efface le r�pertoire de pdf provisoire
 		$comref = sanitize_string($this->ref);
 		if ($conf->commande->dir_output)
 		{
-				$dir = $conf->commande->dir_output . "/" . $comref ;
-				$file = $conf->commande->dir_output . "/" . $comref . "/" . $comref . ".pdf";
-				if (file_exists($file))
+			$dir = $conf->commande->dir_output . "/" . $comref ;
+			$file = $conf->commande->dir_output . "/" . $comref . "/" . $comref . ".pdf";
+			if (file_exists($file))
+			{
+				commande_delete_preview($this->db, $this->id, $this->ref);
+	
+				if (!dol_delete_file($file))
 				{
-					commande_delete_preview($this->db, $this->id, $this->ref);
-					
-					if (!dol_delete_file($file))
-					{
-              $this->error=$langs->trans("ErrorCanNotDeleteFile",$file);
-              return 0;
-           }
-        }
-        if (file_exists($dir))
-        {
-         	if (!dol_delete_dir($dir))
-          {
-            	$this->error=$langs->trans("ErrorCanNotDeleteDir",$dir);
-              return 0;
-          }
-        }
-     }
-
+					$this->error=$langs->trans("ErrorCanNotDeleteFile",$file);
+					$this->db->rollback();
+					return 0;
+				}
+			}
+			if (file_exists($dir))
+			{
+				if (!dol_delete_dir($dir))
+				{
+					$this->error=$langs->trans("ErrorCanNotDeleteDir",$dir);
+					$this->db->rollback();
+					return 0;
+				}
+			}
+		}
+	
 		if ($err == 0)
 		{
+			// Appel des triggers
+			include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
+			$interface=new Interfaces($this->db);
+			$result=$interface->run_triggers('ORDER_DELETE',$this,$user,$langs,$conf);
+			// Fin appel triggers
+	
 			$this->db->commit();
 			return 1;
 		}
diff --git a/htdocs/fourn/fournisseur.commande.class.php b/htdocs/fourn/fournisseur.commande.class.php
index 3d648824ef23aaef84993bdca7130dce6d5e9957..85647fc815899d2cc0ed948e0c676087875e9416 100644
--- a/htdocs/fourn/fournisseur.commande.class.php
+++ b/htdocs/fourn/fournisseur.commande.class.php
@@ -178,66 +178,84 @@ class CommandeFournisseur extends Commande
         }
     }
 
-  /**
-   * Valide la commande
-   *
-   *
-   */
-   function valid($user)
+	/**
+	 *		\brief		Valide la commande
+	 *		\param		user		Utilisateur qui valide
+	 */
+	function valid($user)
     {
-      dolibarr_syslog("CommandeFournisseur::Valid");
-      $result = 0;
-      if ($user->rights->fournisseur->commande->valider)
-	    {
-        if (defined('COMMANDE_SUPPLIER_ADDON'))
-			  {
-				   if (is_readable(DOL_DOCUMENT_ROOT .'/fourn/commande/modules/'.COMMANDE_SUPPLIER_ADDON.'.php'))
-				   {
-					   require_once DOL_DOCUMENT_ROOT .'/fourn/commande/modules/'.COMMANDE_SUPPLIER_ADDON.'.php';
-
+		dolibarr_syslog("CommandeFournisseur::Valid");
+		$result = 0;
+		if ($user->rights->fournisseur->commande->valider)
+		{
+			if (defined('COMMANDE_SUPPLIER_ADDON'))
+			{
+				if (is_readable(DOL_DOCUMENT_ROOT .'/fourn/commande/modules/'.COMMANDE_SUPPLIER_ADDON.'.php'))
+				{
+					$this->db->begin();
+					
+					require_once DOL_DOCUMENT_ROOT .'/fourn/commande/modules/'.COMMANDE_SUPPLIER_ADDON.'.php';
+		
 					// Definition du nom de module de numerotation de commande fournisseur
-
+		
 					$modName=COMMANDE_SUPPLIER_ADDON;
-
+		
 					// Recuperation de la nouvelle reference
 					$objMod = new $modName($this->db);
 					$soc = new Societe($this->db);
 					$soc->fetch($this->socidp);
 					$num = $objMod->commande_get_num($soc);
-
+		
 					$sql = 'UPDATE '.MAIN_DB_PREFIX."commande_fournisseur SET ref='$num', fk_statut = 1, date_valid=now(), fk_user_valid=$user->id";
 					$sql .= " WHERE rowid = $this->id AND fk_statut = 0 ;";
-
-					if ($this->db->query($sql) )
+		
+					$resql=$this->db->query($sql);
+					if ($resql)
 					{
 						$result = 1;
 						$this->log($user, 1, time());
-	          $this->ref = $num;
-	          $this->_NotifyApprobator($user);
+						$this->ref = $num;
+
+		                // Appel des triggers
+		                include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
+		                $interface=new Interfaces($this->db);
+		                $result=$interface->run_triggers('ORDER_SUPPLIER_VALIDATE',$this,$user,$langs,$conf);
+		                // Fin appel triggers
+
+						$this->_NotifyApprobator($user);	// \todo a gerer par trigger
+		
+		                dolibarr_syslog("CommandeFournisseur::valid Success");
+						$this->db->begin();
+						return 1;
 					}
 					else
 					{
-						$result = -1;
-						dolibarr_print_error($this->db);
-						dolibarr_syslog("CommandeFournisseur::Valid Error -1");
+						$this->error=$this->db->error();
+						dolibarr_syslog("CommandeFournisseur::valid ".$this->error);
+						$this->db->rollback();
+						return -1;
 					}
-
 				}
 				else
 				{
-					print 'Impossible de lire le module de num�rotation';
+					$this->error='Impossible de lire le module de num�rotation';
+					dolibarr_syslog("CommandeFournisseur::valid ".$this->error);
+					return -1;
 				}
 			}
 			else
 			{
-				print 'Le module de num�rotation n\'est pas d�fini' ;
+				$this->error='Le module de num�rotation n\'est pas d�fini' ;
+				dolibarr_syslog("CommandeFournisseur::valid ".$this->error);
+				return -1;
 			}
 		}
-	  else
-	  {
-		  dolibarr_syslog("CommandeFournisseur::Valid Not Authorized");
-	  }
-	 return $result ;
+		else
+		{
+			$this->error='Not Authorized';
+			dolibarr_syslog("CommandeFournisseur::valid ".$this->error);
+			return -1;
+		}
 	}
 
   /**
@@ -561,6 +579,12 @@ class CommandeFournisseur extends Commande
                 // On logue creation pour historique   
                 $this->log($user, 0, time());
                 
+                // Appel des triggers
+                include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
+                $interface=new Interfaces($this->db);
+                $result=$interface->run_triggers('ORDER_SUPPLIER_CREATE',$this,$user,$langs,$conf);
+                // Fin appel triggers
+
                 dolibarr_syslog("CommandeFournisseur::Create : Success");
                 $this->db->commit();
                 return 1;
@@ -746,38 +770,45 @@ class CommandeFournisseur extends Commande
     }
 
   /**
-   * Supprime la commande
+   * 	\brief		Supprime la commande
    *
    */
-  function delete()
-  {
-    $err = 0;
-
-    $this->db->begin();
-
-    $sql = "DELETE FROM ".MAIN_DB_PREFIX."commande_fournisseurdet WHERE fk_commande =". $this->id ;
-    if (! $this->db->query($sql) ) 
-      {
-	$err++;
-      }
-
-    $sql = "DELETE FROM ".MAIN_DB_PREFIX."commande_fournisseur WHERE rowid =".$this->id;
-    if (! $this->db->query($sql) ) 
-      {
-	$err++;
-      }
-
-    if ($err == 0)
-      {
-	$this->db->commit();
-	return 1;
-      }
-    else
-      {
-	$this->db->rollback();
-	return -1;
-      }
-  }
+	function delete()
+	{
+		$err = 0;
+	
+		$this->db->begin();
+	
+		$sql = "DELETE FROM ".MAIN_DB_PREFIX."commande_fournisseurdet WHERE fk_commande =". $this->id ;
+		if (! $this->db->query($sql) )
+		{
+			$err++;
+		}
+	
+		$sql = "DELETE FROM ".MAIN_DB_PREFIX."commande_fournisseur WHERE rowid =".$this->id;
+		if (! $this->db->query($sql) )
+		{
+			$err++;
+		}
+	
+		if ($err == 0)
+		{
+            // Appel des triggers
+            include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
+            $interface=new Interfaces($this->db);
+            $result=$interface->run_triggers('ORDER_SUPPLIER_DELETE',$this,$user,$langs,$conf);
+            // Fin appel triggers
+
+            dolibarr_syslog("CommandeFournisseur::delete : Success");
+			$this->db->commit();
+			return 1;
+		}
+		else
+		{
+			$this->db->rollback();
+			return -1;
+		}
+	}
 
 	/**
 	 *		\brief		Positionne modele derniere generation
diff --git a/htdocs/includes/triggers/interface_demo.class.php b/htdocs/includes/triggers/interface_demo.class.php
index 733777f5643dc5e9e63b7ef35ce1c868352de32c..1287a90f4eddd2643f8934d787f438fdcc57c6a2 100644
--- a/htdocs/includes/triggers/interface_demo.class.php
+++ b/htdocs/includes/triggers/interface_demo.class.php
@@ -144,15 +144,25 @@ class InterfaceDemo
         {
             dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
         }
+		// Customer orders
         elseif ($action == 'ORDER_CREATE')
         {
             dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
         }
-        elseif ($action == 'ORDER_MODIFY')
+        elseif ($action == 'ORDER_VALIDATE')
         {
             dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
         }
         elseif ($action == 'ORDER_DELETE')
+        {
+            dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
+        }
+		// Supplier orders
+        elseif ($action == 'ORDER_SUPPLIER_CREATE')
+        {
+            dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
+        }
+        elseif ($action == 'ORDER_SUPPLIER_VALIDATE')
         {
             dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
         }