diff --git a/htdocs/commande/commande.class.php b/htdocs/commande/commande.class.php
index 924fe36d4707a9ff543d0933c9a2b567050ab6dd..d4897ff72d956ab0c3ea01b8b3f0476973776d21 100644
--- a/htdocs/commande/commande.class.php
+++ b/htdocs/commande/commande.class.php
@@ -175,6 +175,9 @@ class Commande extends CommonObject
 					$objMod = new $modName($this->db);
 					$soc = new Societe($this->db);
 					$soc->fetch($this->socidp);
+					
+					// Classe la soci�t� rattach�e comme client
+          $result=$soc->set_as_client();
 		
 					// on v�rifie si la commande est en num�rotation provisoire
 					$comref = substr($this->ref, 1, 4);
diff --git a/htdocs/facture.class.php b/htdocs/facture.class.php
index d5f1172a1dfc657edd65fbaca2e17803a6c88a25..3ec7735ee56185f1dd2999ef2b6c93f337826d62 100644
--- a/htdocs/facture.class.php
+++ b/htdocs/facture.class.php
@@ -977,6 +977,12 @@ class Facture extends CommonObject
 
             if ($error == 0)
             {
+                
+                // Classe la soci�t� rattach�e comme client
+                $soc=new Societe($this->db);
+                $soc->id = $this->socidp;
+                $result=$soc->set_as_client();
+                
                 $this->ref = $numfa;
 
                 $this->use_webcal=($conf->global->PHPWEBCALENDAR_BILLSTATUS=='always'?1:0);