From b320208d3ad47a6ade84709159eaa89a99f94bed Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 5 Nov 2009 20:25:10 +0000 Subject: [PATCH] Fix: no stock mouvement with free line product --- htdocs/fourn/fournisseur.commande.class.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/htdocs/fourn/fournisseur.commande.class.php b/htdocs/fourn/fournisseur.commande.class.php index 24c61b0cae8..7105dd109f0 100644 --- a/htdocs/fourn/fournisseur.commande.class.php +++ b/htdocs/fourn/fournisseur.commande.class.php @@ -543,11 +543,15 @@ class CommandeFournisseur extends Commande for ($i = 0 ; $i < sizeof($this->lignes) ; $i++) { - $mouvP = new MouvementStock($this->db); - // We decrement 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, $this->lignes[$i]->subprice); - if ($result < 0) { $error++; } + // Product with reference + if (!empty($this->lignes[$i]->fk_product)) + { + $mouvP = new MouvementStock($this->db); + // We decrement 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, $this->lignes[$i]->subprice); + if ($result < 0) { $error++; } + } } }