Fix: Message for stock movement was wrong or missing
This commit is contained in:
parent
8d1284ed42
commit
3d0c324f5f
@ -241,15 +241,15 @@ class Commande extends CommonObject
|
||||
$langs->load("agenda");
|
||||
|
||||
// Loop on each line
|
||||
$num=count($this->lines);
|
||||
for ($i = 0; $i < $num; $i++)
|
||||
$cpt=count($this->lines);
|
||||
for ($i = 0; $i < $cpt; $i++)
|
||||
{
|
||||
if ($this->lines[$i]->fk_product > 0)
|
||||
{
|
||||
$langs->load("agenda");
|
||||
$mouvP = new MouvementStock($this->db);
|
||||
// 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++; }
|
||||
}
|
||||
}
|
||||
@ -361,7 +361,7 @@ class Commande extends CommonObject
|
||||
$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->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++; }
|
||||
}
|
||||
}
|
||||
@ -534,7 +534,7 @@ class Commande extends CommonObject
|
||||
$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->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++; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -1606,8 +1606,8 @@ class Facture extends CommonObject
|
||||
$langs->load("agenda");
|
||||
|
||||
// Loop on each line
|
||||
$num=count($this->lines);
|
||||
for ($i = 0; $i < $num; $i++)
|
||||
$cpt=count($this->lines);
|
||||
for ($i = 0; $i < $cpt; $i++)
|
||||
{
|
||||
if ($this->lines[$i]->fk_product > 0)
|
||||
{
|
||||
|
||||
@ -412,10 +412,10 @@ class Expedition extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate object and update stock if option enabled
|
||||
* Validate object and update stock if option enabled
|
||||
*
|
||||
* @param User $user Object user that validate
|
||||
* @return int <0 if OK, >0 if KO
|
||||
* @param User $user Object user that validate
|
||||
* @return int <0 if OK, >0 if KO
|
||||
*/
|
||||
function valid($user)
|
||||
{
|
||||
@ -489,8 +489,8 @@ class Expedition extends CommonObject
|
||||
// Loop on each product line to add a stock movement
|
||||
// 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.= " FROM ".MAIN_DB_PREFIX."commandedet as cd";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."expeditiondet as ed";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."commandedet as cd,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."expeditiondet as ed";
|
||||
$sql.= " WHERE ed.fk_expedition = ".$this->id;
|
||||
$sql.= " AND cd.rowid = ed.fk_origin_line";
|
||||
|
||||
@ -498,9 +498,8 @@ class Expedition extends CommonObject
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i=0;
|
||||
while($i < $num)
|
||||
$cpt = $this->db->num_rows($resql);
|
||||
for ($i = 0; $i < $cpt; $i++)
|
||||
{
|
||||
dol_syslog("Expedition::valid movement index ".$i);
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
@ -509,7 +508,7 @@ class Expedition extends CommonObject
|
||||
$mouvS = new MouvementStock($this->db);
|
||||
// We decrement stock of product (and sub-products)
|
||||
// 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; }
|
||||
|
||||
$i++;
|
||||
|
||||
@ -377,8 +377,9 @@ class CommandeFournisseur extends Commande
|
||||
|
||||
/**
|
||||
* Set draft status
|
||||
* @param user Object user that modify
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*
|
||||
* @param User $user Object user that modify
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function set_draft($user)
|
||||
{
|
||||
@ -421,7 +422,7 @@ class CommandeFournisseur extends Commande
|
||||
$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->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++; }
|
||||
}
|
||||
}
|
||||
@ -612,6 +613,7 @@ class CommandeFournisseur extends Commande
|
||||
|
||||
/**
|
||||
* Accept an order
|
||||
*
|
||||
* @param user Object user
|
||||
* @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");
|
||||
|
||||
$num=count($this->lines);
|
||||
for ($i = 0; $i < $num; $i++)
|
||||
$cpt=count($this->lines);
|
||||
for ($i = 0; $i < $cpt; $i++)
|
||||
{
|
||||
// Product with reference
|
||||
if ($this->lines[$i]->fk_product > 0)
|
||||
@ -649,7 +651,7 @@ class CommandeFournisseur extends Commande
|
||||
$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->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++; }
|
||||
}
|
||||
}
|
||||
@ -1074,6 +1076,7 @@ class CommandeFournisseur extends Commande
|
||||
|
||||
/**
|
||||
* Add a product into a stock warehouse.
|
||||
*
|
||||
* @param $user User object making change
|
||||
* @param $product Id of product to dispatch
|
||||
* @param $qty Qty to dispatch
|
||||
|
||||
@ -789,8 +789,8 @@ class FactureFournisseur extends Facture
|
||||
require_once(DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php");
|
||||
$langs->load("agenda");
|
||||
|
||||
$num=count($this->lines);
|
||||
for ($i = 0; $i < $num; $i++)
|
||||
$cpt=count($this->lines);
|
||||
for ($i = 0; $i < $cpt; $i++)
|
||||
{
|
||||
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");
|
||||
$langs->load("agenda");
|
||||
|
||||
$num=count($this->lines);
|
||||
for ($i = 0; $i < $num; $i++)
|
||||
$cpt=count($this->lines);
|
||||
for ($i = 0; $i < $cpt; $i++)
|
||||
{
|
||||
if ($this->lines[$i]->fk_product > 0)
|
||||
{
|
||||
|
||||
@ -204,6 +204,7 @@ MemberValidatedInDolibarr=Member %s validated in Dolibarr
|
||||
MemberResiliatedInDolibarr=Member %s resiliated in Dolibarr
|
||||
MemberDeletedInDolibarr=Member %s deleted from Dolibarr
|
||||
MemberSubscriptionAddedInDolibarr=Subscription for member %s added in Dolibarr
|
||||
ShipmentValidatedInDolibarr=Shipment %s validated in Dolibarr
|
||||
##### Export #####
|
||||
Export=Export
|
||||
ExportsArea=Exports area
|
||||
|
||||
@ -203,6 +203,7 @@ MemberValidatedInDolibarr=Adhérent %s validé dans Dolibarr
|
||||
MemberResiliatedInDolibarr=Adhérent %s résilié dans Dolibarr
|
||||
MemberDeletedInDolibarr=Adhérent %s supprimé de Dolibarr
|
||||
MemberSubscriptionAddedInDolibarr=Souscription adhérent %s ajoutée dans Dolibarr
|
||||
ShipmentValidatedInDolibarr=Expédition %s validée dans Dolibarr
|
||||
##### Export #####
|
||||
Export=Export
|
||||
ExportsArea=Espace exports
|
||||
|
||||
Loading…
Reference in New Issue
Block a user