Fix: un produit d'une zone libre ne doit pas �tre incrŽmentŽ lors du passage en mode brouillon d'une commande client lorsque la dŽcrŽmentation du stock se fait sur les commandes
This commit is contained in:
parent
b5c9327c80
commit
031b00b2f6
@ -278,7 +278,7 @@ class Commande extends CommonObject
|
|||||||
{
|
{
|
||||||
$mouvP = new MouvementStock($this->db);
|
$mouvP = new MouvementStock($this->db);
|
||||||
// We decrement stock of product (and sub-products)
|
// We decrement stock of product (and sub-products)
|
||||||
$entrepot_id = "1"; // TODO ajouter possibilit<EFBFBD> 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
|
// 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);
|
$result=$mouvP->livraison($user, $this->lignes[$i]->fk_product, $entrepot_id, $this->lignes[$i]->qty);
|
||||||
if ($result < 0) { $error++; }
|
if ($result < 0) { $error++; }
|
||||||
@ -349,6 +349,8 @@ class Commande extends CommonObject
|
|||||||
function set_draft($user)
|
function set_draft($user)
|
||||||
{
|
{
|
||||||
global $conf,$langs;
|
global $conf,$langs;
|
||||||
|
|
||||||
|
$error=0;
|
||||||
|
|
||||||
// Protection
|
// Protection
|
||||||
if ($this->statut <= 0)
|
if ($this->statut <= 0)
|
||||||
@ -378,13 +380,17 @@ class Commande extends CommonObject
|
|||||||
|
|
||||||
for ($i = 0 ; $i < sizeof($this->lignes) ; $i++)
|
for ($i = 0 ; $i < sizeof($this->lignes) ; $i++)
|
||||||
{
|
{
|
||||||
$mouvP = new MouvementStock($this->db);
|
if ($this->lignes[$i]->fk_product > 0 && $this->lignes[$i]->product_type == 0)
|
||||||
// We increment stock of product (and sub-products)
|
{
|
||||||
$entrepot_id = "1"; //Todo: ajouter possibilite de choisir l'entrepot
|
$mouvP = new MouvementStock($this->db);
|
||||||
$result=$mouvP->reception($user, $this->lignes[$i]->fk_product, $entrepot_id, $this->lignes[$i]->qty);
|
// 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->statut=0;
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user