From 031b00b2f667e9da67521dba5227f9721cd4c87a Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 21 Jun 2009 03:46:34 +0000 Subject: [PATCH] =?UTF-8?q?Fix:=20un=20produit=20d'une=20zone=20libre=20ne?= =?UTF-8?q?=20doit=20pas=20=90tre=20incr=8Ement=8E=20lors=20du=20passage?= =?UTF-8?q?=20en=20mode=20brouillon=20d'une=20commande=20client=20lorsque?= =?UTF-8?q?=20la=20d=8Ecr=8Ementation=20du=20stock=20se=20fait=20sur=20les?= =?UTF-8?q?=20commandes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/commande/commande.class.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/htdocs/commande/commande.class.php b/htdocs/commande/commande.class.php index e36b10f4cef..d053b05e901 100644 --- a/htdocs/commande/commande.class.php +++ b/htdocs/commande/commande.class.php @@ -278,7 +278,7 @@ class Commande extends CommonObject { $mouvP = new MouvementStock($this->db); // We decrement stock of product (and sub-products) - $entrepot_id = "1"; // TODO ajouter possibilit� de choisir l'entrepot + $entrepot_id = "1"; // TODO ajouter possibilite de choisir l'entrepot // TODO Add price of product in method or '' to update PMP $result=$mouvP->livraison($user, $this->lignes[$i]->fk_product, $entrepot_id, $this->lignes[$i]->qty); if ($result < 0) { $error++; } @@ -349,6 +349,8 @@ class Commande extends CommonObject function set_draft($user) { global $conf,$langs; + + $error=0; // Protection if ($this->statut <= 0) @@ -378,13 +380,17 @@ class Commande extends CommonObject for ($i = 0 ; $i < sizeof($this->lignes) ; $i++) { - $mouvP = new MouvementStock($this->db); - // We increment stock of product (and sub-products) - $entrepot_id = "1"; //Todo: ajouter possibilite de choisir l'entrepot - $result=$mouvP->reception($user, $this->lignes[$i]->fk_product, $entrepot_id, $this->lignes[$i]->qty); + if ($this->lignes[$i]->fk_product > 0 && $this->lignes[$i]->product_type == 0) + { + $mouvP = new MouvementStock($this->db); + // We increment stock of product (and sub-products) + $entrepot_id = "1"; //Todo: ajouter possibilite de choisir l'entrepot + $result=$mouvP->reception($user, $this->lignes[$i]->fk_product, $entrepot_id, $this->lignes[$i]->qty); + if ($result < 0) { $error++; } + } } - if ($result > 0) + if (!$error) { $this->statut=0; $this->db->commit();