Fix: Message for stock movement was wrong or missing

This commit is contained in:
Laurent Destailleur 2011-11-08 00:03:19 +01:00
parent 8d1284ed42
commit 3d0c324f5f
7 changed files with 30 additions and 26 deletions

View File

@ -241,15 +241,15 @@ class Commande extends CommonObject
$langs->load("agenda"); $langs->load("agenda");
// Loop on each line // Loop on each line
$num=count($this->lines); $cpt=count($this->lines);
for ($i = 0; $i < $num; $i++) for ($i = 0; $i < $cpt; $i++)
{ {
if ($this->lines[$i]->fk_product > 0) if ($this->lines[$i]->fk_product > 0)
{ {
$langs->load("agenda"); $langs->load("agenda");
$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)
$result=$mouvP->livraison($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("OrderValidatedInDolibarr",$this->ref)); $result=$mouvP->livraison($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("OrderValidatedInDolibarr",$num));
if ($result < 0) { $error++; } if ($result < 0) { $error++; }
} }
} }
@ -361,7 +361,7 @@ class Commande extends CommonObject
$mouvP = new MouvementStock($this->db); $mouvP = new MouvementStock($this->db);
// We increment stock of product (and sub-products) // We increment stock of product (and sub-products)
$entrepot_id = "1"; //Todo: ajouter possibilite de choisir l'entrepot $entrepot_id = "1"; //Todo: ajouter possibilite de choisir l'entrepot
$result=$mouvP->reception($user, $this->lines[$i]->fk_product, $entrepot_id, $this->lines[$i]->qty, $this->lines[$i]->subprice); $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $entrepot_id, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("OrderBackToDraftInDolibarr",$this->ref));
if ($result < 0) { $error++; } if ($result < 0) { $error++; }
} }
} }
@ -534,7 +534,7 @@ class Commande extends CommonObject
$mouvP = new MouvementStock($this->db); $mouvP = new MouvementStock($this->db);
// We increment stock of product (and sub-products) // We increment stock of product (and sub-products)
$entrepot_id = "1"; //Todo: ajouter possibilite de choisir l'entrepot $entrepot_id = "1"; //Todo: ajouter possibilite de choisir l'entrepot
$result=$mouvP->reception($user, $this->lines[$i]->fk_product, $entrepot_id, $this->lines[$i]->qty, $this->lines[$i]->subprice); $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $entrepot_id, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("OrderCanceledInDolibarr",$this->ref));
if ($result < 0) { $error++; } if ($result < 0) { $error++; }
} }
} }

View File

@ -1606,8 +1606,8 @@ class Facture extends CommonObject
$langs->load("agenda"); $langs->load("agenda");
// Loop on each line // Loop on each line
$num=count($this->lines); $cpt=count($this->lines);
for ($i = 0; $i < $num; $i++) for ($i = 0; $i < $cpt; $i++)
{ {
if ($this->lines[$i]->fk_product > 0) if ($this->lines[$i]->fk_product > 0)
{ {

View File

@ -489,8 +489,8 @@ class Expedition extends CommonObject
// Loop on each product line to add a stock movement // Loop on each product line to add a stock movement
// TODO possibilite d'expedier a partir d'une propale ou autre origine // TODO possibilite d'expedier a partir d'une propale ou autre origine
$sql = "SELECT cd.fk_product, cd.subprice, ed.qty, ed.fk_entrepot"; $sql = "SELECT cd.fk_product, cd.subprice, ed.qty, ed.fk_entrepot";
$sql.= " FROM ".MAIN_DB_PREFIX."commandedet as cd"; $sql.= " FROM ".MAIN_DB_PREFIX."commandedet as cd,";
$sql.= ", ".MAIN_DB_PREFIX."expeditiondet as ed"; $sql.= " ".MAIN_DB_PREFIX."expeditiondet as ed";
$sql.= " WHERE ed.fk_expedition = ".$this->id; $sql.= " WHERE ed.fk_expedition = ".$this->id;
$sql.= " AND cd.rowid = ed.fk_origin_line"; $sql.= " AND cd.rowid = ed.fk_origin_line";
@ -498,9 +498,8 @@ class Expedition extends CommonObject
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
$num = $this->db->num_rows($resql); $cpt = $this->db->num_rows($resql);
$i=0; for ($i = 0; $i < $cpt; $i++)
while($i < $num)
{ {
dol_syslog("Expedition::valid movement index ".$i); dol_syslog("Expedition::valid movement index ".$i);
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
@ -509,7 +508,7 @@ class Expedition extends CommonObject
$mouvS = new MouvementStock($this->db); $mouvS = new MouvementStock($this->db);
// We decrement stock of product (and sub-products) // We decrement stock of product (and sub-products)
// We use warehouse selected for each line // We use warehouse selected for each line
$result=$mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $obj->qty, $obj->subprice); $result=$mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $obj->qty, $obj->subprice, $langs->trans("ShipmentValidatedInDolibarr",$numref));
if ($result < 0) { $error++; break; } if ($result < 0) { $error++; break; }
$i++; $i++;

View File

@ -377,7 +377,8 @@ class CommandeFournisseur extends Commande
/** /**
* Set draft status * Set draft status
* @param user Object user that modify *
* @param User $user Object user that modify
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function set_draft($user) function set_draft($user)
@ -421,7 +422,7 @@ class CommandeFournisseur extends Commande
$mouvP = new MouvementStock($this->db); $mouvP = new MouvementStock($this->db);
// We increment stock of product (and sub-products) // We increment stock of product (and sub-products)
$entrepot_id = "1"; // TODO ajouter possibilite de choisir l'entrepot $entrepot_id = "1"; // TODO ajouter possibilite de choisir l'entrepot
$result=$mouvP->reception($user, $this->lines[$i]->fk_product, $entrepot_id, $this->lines[$i]->qty, $this->lines[$i]->subprice); $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $entrepot_id, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("OrderBackToDraftInDolibarr",$this->ref));
if ($result < 0) { $error++; } if ($result < 0) { $error++; }
} }
} }
@ -612,6 +613,7 @@ class CommandeFournisseur extends Commande
/** /**
* Accept an order * Accept an order
*
* @param user Object user * @param user Object user
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
@ -640,8 +642,8 @@ class CommandeFournisseur extends Commande
{ {
require_once(DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php"); require_once(DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php");
$num=count($this->lines); $cpt=count($this->lines);
for ($i = 0; $i < $num; $i++) for ($i = 0; $i < $cpt; $i++)
{ {
// Product with reference // Product with reference
if ($this->lines[$i]->fk_product > 0) if ($this->lines[$i]->fk_product > 0)
@ -649,7 +651,7 @@ class CommandeFournisseur extends Commande
$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 possibilite de choisir l'entrepot $entrepot_id = "1"; // TODO ajouter possibilite de choisir l'entrepot
$result=$mouvP->reception($user, $this->lines[$i]->fk_product, $entrepot_id, $this->lines[$i]->qty, $this->lines[$i]->subprice); $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $entrepot_id, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("OrderApprovedInDolibarr",$this->ref));
if ($result < 0) { $error++; } if ($result < 0) { $error++; }
} }
} }
@ -1074,6 +1076,7 @@ class CommandeFournisseur extends Commande
/** /**
* Add a product into a stock warehouse. * Add a product into a stock warehouse.
*
* @param $user User object making change * @param $user User object making change
* @param $product Id of product to dispatch * @param $product Id of product to dispatch
* @param $qty Qty to dispatch * @param $qty Qty to dispatch

View File

@ -789,8 +789,8 @@ class FactureFournisseur extends Facture
require_once(DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php"); require_once(DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php");
$langs->load("agenda"); $langs->load("agenda");
$num=count($this->lines); $cpt=count($this->lines);
for ($i = 0; $i < $num; $i++) for ($i = 0; $i < $cpt; $i++)
{ {
if ($this->lines[$i]->fk_product > 0) if ($this->lines[$i]->fk_product > 0)
{ {
@ -865,8 +865,8 @@ class FactureFournisseur extends Facture
require_once(DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php"); require_once(DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php");
$langs->load("agenda"); $langs->load("agenda");
$num=count($this->lines); $cpt=count($this->lines);
for ($i = 0; $i < $num; $i++) for ($i = 0; $i < $cpt; $i++)
{ {
if ($this->lines[$i]->fk_product > 0) if ($this->lines[$i]->fk_product > 0)
{ {

View File

@ -204,6 +204,7 @@ MemberValidatedInDolibarr=Member %s validated in Dolibarr
MemberResiliatedInDolibarr=Member %s resiliated in Dolibarr MemberResiliatedInDolibarr=Member %s resiliated in Dolibarr
MemberDeletedInDolibarr=Member %s deleted from Dolibarr MemberDeletedInDolibarr=Member %s deleted from Dolibarr
MemberSubscriptionAddedInDolibarr=Subscription for member %s added in Dolibarr MemberSubscriptionAddedInDolibarr=Subscription for member %s added in Dolibarr
ShipmentValidatedInDolibarr=Shipment %s validated in Dolibarr
##### Export ##### ##### Export #####
Export=Export Export=Export
ExportsArea=Exports area ExportsArea=Exports area

View File

@ -203,6 +203,7 @@ MemberValidatedInDolibarr=Adhérent %s validé dans Dolibarr
MemberResiliatedInDolibarr=Adhérent %s résilié dans Dolibarr MemberResiliatedInDolibarr=Adhérent %s résilié dans Dolibarr
MemberDeletedInDolibarr=Adhérent %s supprimé de Dolibarr MemberDeletedInDolibarr=Adhérent %s supprimé de Dolibarr
MemberSubscriptionAddedInDolibarr=Souscription adhérent %s ajoutée dans Dolibarr MemberSubscriptionAddedInDolibarr=Souscription adhérent %s ajoutée dans Dolibarr
ShipmentValidatedInDolibarr=Expédition %s validée dans Dolibarr
##### Export ##### ##### Export #####
Export=Export Export=Export
ExportsArea=Espace exports ExportsArea=Espace exports