Fix: no stock mouvement with free line product

This commit is contained in:
Regis Houssin 2009-11-05 20:25:10 +00:00
parent ec9ab24fd0
commit b320208d3a

View File

@ -543,11 +543,15 @@ class CommandeFournisseur extends Commande
for ($i = 0 ; $i < sizeof($this->lignes) ; $i++) for ($i = 0 ; $i < sizeof($this->lignes) ; $i++)
{ {
$mouvP = new MouvementStock($this->db); // Product with reference
// We decrement stock of product (and sub-products) if (!empty($this->lignes[$i]->fk_product))
$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); $mouvP = new MouvementStock($this->db);
if ($result < 0) { $error++; } // 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++; }
}
} }
} }