From f3ef9b868f9c4a25189479cc6fe21e0ebfaee39d Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Mon, 5 Oct 2015 16:19:54 +0200 Subject: [PATCH 01/14] fix entities warehouse share --- htdocs/product/class/product.class.php | 2 +- htdocs/product/stock/class/entrepot.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index e6695b75bc6..9d409e73c32 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2662,7 +2662,7 @@ class Product extends CommonObject $sql = "SELECT ps.reel, ps.fk_entrepot, ps.pmp"; $sql.= " FROM ".MAIN_DB_PREFIX."product_stock as ps"; $sql.= ", ".MAIN_DB_PREFIX."entrepot as w"; - $sql.= " WHERE w.entity IN (".getEntity('warehouse', 1).")"; + $sql.= " WHERE w.entity IN (".getEntity('stock', 1).")"; $sql.= " AND w.rowid = ps.fk_entrepot"; $sql.= " AND ps.fk_product = ".$this->id; diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 384b3712674..1056829838b 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -358,7 +358,7 @@ class Entrepot extends CommonObject $sql = "SELECT rowid, label"; $sql.= " FROM ".MAIN_DB_PREFIX."entrepot"; - $sql.= " WHERE entity IN (".getEntity('warehouse', 1).")"; + $sql.= " WHERE entity IN (".getEntity('stock', 1).")"; $sql.= " AND statut = ".$status; $result = $this->db->query($sql); From 00f0aff6f0cead68aa186b5c704b564b27d04ed2 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Thu, 8 Oct 2015 15:58:19 +0200 Subject: [PATCH 02/14] FIX: change order date on clone (as everywhere else) --- htdocs/commande/class/commande.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 7a8fd63c8f1..cdb753698a4 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -881,6 +881,7 @@ class Commande extends CommonOrder // Clear fields $this->user_author_id = $user->id; $this->user_valid = ''; + $this->date = dol_now(); $this->date_creation = ''; $this->date_validation = ''; $this->ref_client = ''; From c06c2d0464925ff0fe8c8982b434b23a2afd4a7a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 2 Nov 2015 14:21:45 +0100 Subject: [PATCH 03/14] FIX #3841 creation of a task completed has not status set to finished by default --- htdocs/core/lib/company.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 7fbac977d79..380ecd80943 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1204,7 +1204,7 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0) { $out.=''; + $out.=(! empty($objcon->id)?'&contactid='.$objcon->id:'').'&backtopage=1&percentage=100">'; $out.=$langs->trans("AddAnAction").' '; $out.=img_picto($langs->trans("AddAnAction"),'filenew'); $out.=""; From 69ac75bef8570112e0ce94e03b2f70805042e35d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Wed, 4 Nov 2015 22:55:14 +0100 Subject: [PATCH 04/14] Fix #3864 Fixed invalid jQuery code --- htdocs/core/tpl/objectline_create.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index a8c9434acec..190fad96c51 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -446,7 +446,7 @@ jQuery(document).ready(function() { rights->margins->creer) { ?> /* Code for margin */ - $("#fournprice_predef options").remove(); + $("#fournprice_predef option").each.remove(); $("#fournprice_predef").hide(); $("#buying_price").val("").show(); $.post('/fourn/ajax/getSupplierPrices.php', { 'idprod': $(this).val() }, function(data) { From 0543a3192006eed4b24f331e5aef1833ebbfc396 Mon Sep 17 00:00:00 2001 From: Alexis Algoud Date: Thu, 5 Nov 2015 11:11:03 +0100 Subject: [PATCH 05/14] FIX event's data lost on user assign update --- htdocs/comm/action/card.php | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index c011717c0cc..92300a35368 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -88,7 +88,7 @@ $hookmanager->initHooks(array('actioncard','globalcard')); /* * Actions */ - +$listUserAssignedUpdated = false; // Remove user to assigned list if (GETPOST('removedassigned') || GETPOST('removedassigned') == '0') { @@ -106,6 +106,8 @@ if (GETPOST('removedassigned') || GETPOST('removedassigned') == '0') $donotclearsession=1; if ($action == 'add') $action = 'create'; if ($action == 'update') $action = 'edit'; + + $listUserAssignedUpdated = true; } // Add user to assigned list @@ -125,6 +127,8 @@ if (GETPOST('addassignedtouser') || GETPOST('updateassignedtouser')) $donotclearsession=1; if ($action == 'add') $action = 'create'; if ($action == 'update') $action = 'edit'; + + $listUserAssignedUpdated = true; } // Add event @@ -803,6 +807,28 @@ if ($id > 0) $result4=$object->fetch_userassigned(); $result5=$object->fetch_optionals($id,$extralabels); + if($listUserAssignedUpdated) { + + $datep=dol_mktime($fulldayevent?'00':$aphour, $fulldayevent?'00':$apmin, 0, $_POST["apmonth"], $_POST["apday"], $_POST["apyear"]); + $datef=dol_mktime($fulldayevent?'23':$p2hour, $fulldayevent?'59':$p2min, $fulldayevent?'59':'0', $_POST["p2month"], $_POST["p2day"], $_POST["p2year"]); + + $object->fk_action = dol_getIdFromCode($db, GETPOST("actioncode"), 'c_actioncomm'); + $object->label = GETPOST("label"); + $object->datep = $datep; + $object->datef = $datef; + $object->percentage = $percentage; + $object->priority = GETPOST("priority"); + $object->fulldayevent= GETPOST("fullday")?1:0; + $object->location = GETPOST('location'); + $object->socid = GETPOST("socid"); + $object->contactid = GETPOST("contactid",'int'); + //$object->societe->id = $_POST["socid"]; // deprecated + //$object->contact->id = $_POST["contactid"]; // deprecated + $object->fk_project = GETPOST("projectid",'int'); + + $object->note = GETPOST("note"); + } + if ($result1 < 0 || $result2 < 0 || $result3 < 0 || $result4 < 0 || $result5 < 0) { dol_print_error($db,$object->error); From e1ea2215a3b1f753ea45d1415825bb7e40a62ae3 Mon Sep 17 00:00:00 2001 From: Alexis Algoud Date: Thu, 5 Nov 2015 11:25:04 +0100 Subject: [PATCH 06/14] FIX loss data also if update was cancel by error of ended state with no end date, try a generic patch --- htdocs/comm/action/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 92300a35368..9d6f9590a1c 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -807,7 +807,7 @@ if ($id > 0) $result4=$object->fetch_userassigned(); $result5=$object->fetch_optionals($id,$extralabels); - if($listUserAssignedUpdated) { + if($listUserAssignedUpdated || $donotclearsession) { $datep=dol_mktime($fulldayevent?'00':$aphour, $fulldayevent?'00':$apmin, 0, $_POST["apmonth"], $_POST["apday"], $_POST["apyear"]); $datef=dol_mktime($fulldayevent?'23':$p2hour, $fulldayevent?'59':$p2min, $fulldayevent?'59':'0', $_POST["p2month"], $_POST["p2day"], $_POST["p2year"]); From 9b797c1831932ef0bd0c1ddacbba2535070c2a0b Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Thu, 5 Nov 2015 12:49:43 +0100 Subject: [PATCH 07/14] FIX bad calculation for stock value --- htdocs/product/stock/class/entrepot.class.php | 2 +- htdocs/product/stock/fiche.php | 8 ++++---- htdocs/product/stock/valo.php | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 1056829838b..a21c57e2657 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -418,7 +418,7 @@ class Entrepot extends CommonObject { $ret=array(); - $sql = "SELECT sum(ps.reel) as nb, sum(ps.reel * ps.pmp) as value"; + $sql = "SELECT sum(ps.reel) as nb, sum(ps.reel * p.pmp) as value"; $sql.= " FROM ".MAIN_DB_PREFIX."product_stock as ps"; $sql.= ", ".MAIN_DB_PREFIX."product as p"; $sql.= " WHERE ps.fk_entrepot = ".$this->id; diff --git a/htdocs/product/stock/fiche.php b/htdocs/product/stock/fiche.php index a60deff921e..22b70fda280 100644 --- a/htdocs/product/stock/fiche.php +++ b/htdocs/product/stock/fiche.php @@ -364,7 +364,7 @@ else print_liste_field_titre($langs->trans("Product"),"", "p.ref","&id=".$_GET['id'],"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Label"),"", "p.label","&id=".$_GET['id'],"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Units"),"", "ps.reel","&id=".$_GET['id'],"",'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("AverageUnitPricePMPShort"),"", "ps.pmp","&id=".$_GET['id'],"",'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("AverageUnitPricePMPShort"),"", "p.pmp","&id=".$_GET['id'],"",'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("EstimatedStockValueShort"),"", "","&id=".$_GET['id'],"",'align="right"',$sortfield,$sortorder); if (empty($conf->global->PRODUIT_MULTIPRICES)) print_liste_field_titre($langs->trans("SellPriceMin"),"", "p.price","&id=".$_GET['id'],"",'align="right"',$sortfield,$sortorder); if (empty($conf->global->PRODUIT_MULTIPRICES)) print_liste_field_titre($langs->trans("EstimatedStockValueSellShort"),"", "","&id=".$_GET['id'],"",'align="right"',$sortfield,$sortorder); @@ -426,10 +426,10 @@ else $totalunit+=$objp->value; // Price buy PMP - print ''.price(price2num($objp->pmp,'MU')).''; + print ''.price(price2num($objp->ppmp,'MU')).''; // Total PMP - print ''.price(price2num($objp->pmp*$objp->value,'MT')).''; - $totalvalue+=price2num($objp->pmp*$objp->value,'MT'); + print ''.price(price2num($objp->ppmp*$objp->value,'MT')).''; + $totalvalue+=price2num($objp->ppmp*$objp->value,'MT'); // Price sell min if (empty($conf->global->PRODUIT_MULTIPRICES)) diff --git a/htdocs/product/stock/valo.php b/htdocs/product/stock/valo.php index e7d782ae5e0..3c00168d82b 100644 --- a/htdocs/product/stock/valo.php +++ b/htdocs/product/stock/valo.php @@ -53,7 +53,7 @@ $year = strftime("%Y",time()); // Affichage valorisation par entrepot $sql = "SELECT e.rowid as ref, e.label, e.statut, e.lieu,"; -$sql.= " SUM(ps.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue"; +$sql.= " SUM(p.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue"; $sql.= " FROM ".MAIN_DB_PREFIX."entrepot as e"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON e.rowid = ps.fk_entrepot"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON ps.fk_product = p.rowid"; From b0cf9bd0bebafdaebfe20cc02c4549b5cae1b357 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 5 Nov 2015 14:38:11 +0100 Subject: [PATCH 08/14] Fix #3864 Really fixed invalid jQuery code --- htdocs/core/tpl/objectline_create.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 190fad96c51..b36f61973ee 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -446,7 +446,7 @@ jQuery(document).ready(function() { rights->margins->creer) { ?> /* Code for margin */ - $("#fournprice_predef option").each.remove(); + $("#fournprice_predef").find("option").remove(); $("#fournprice_predef").hide(); $("#buying_price").val("").show(); $.post('/fourn/ajax/getSupplierPrices.php', { 'idprod': $(this).val() }, function(data) { From fa088eb6cc23185e09bbfa18cd1c53afbebd33b9 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Thu, 5 Nov 2015 14:57:58 +0100 Subject: [PATCH 09/14] FIX bad calculation for stock value --- htdocs/product/stock/class/entrepot.class.php | 2 +- htdocs/product/stock/fiche.php | 8 ++++---- htdocs/product/stock/valo.php | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 2b1b368ef8c..6cb2e75fc32 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -418,7 +418,7 @@ class Entrepot extends CommonObject { $ret=array(); - $sql = "SELECT sum(ps.reel) as nb, sum(ps.reel * ps.pmp) as value"; + $sql = "SELECT sum(ps.reel) as nb, sum(ps.reel * p.pmp) as value"; $sql.= " FROM ".MAIN_DB_PREFIX."product_stock as ps"; $sql.= ", ".MAIN_DB_PREFIX."product as p"; $sql.= " WHERE ps.fk_entrepot = ".$this->id; diff --git a/htdocs/product/stock/fiche.php b/htdocs/product/stock/fiche.php index 8b7aa43b431..4f43b3f6c91 100644 --- a/htdocs/product/stock/fiche.php +++ b/htdocs/product/stock/fiche.php @@ -369,7 +369,7 @@ else print_liste_field_titre($langs->trans("Product"),"", "p.ref","&id=".$id,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Label"),"", "p.label","&id=".$id,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Units"),"", "ps.reel","&id=".$id,"",'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("AverageUnitPricePMPShort"),"", "ps.pmp","&id=".$id,"",'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("AverageUnitPricePMPShort"),"", "p.pmp","&id=".$id,"",'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("EstimatedStockValueShort"),"", "","&id=".$id,"",'align="right"',$sortfield,$sortorder); if (empty($conf->global->PRODUIT_MULTIPRICES)) print_liste_field_titre($langs->trans("SellPriceMin"),"", "p.price","&id=".$id,"",'align="right"',$sortfield,$sortorder); if (empty($conf->global->PRODUIT_MULTIPRICES)) print_liste_field_titre($langs->trans("EstimatedStockValueSellShort"),"", "","&id=".$id,"",'align="right"',$sortfield,$sortorder); @@ -431,10 +431,10 @@ else $totalunit+=$objp->value; // Price buy PMP - print ''.price(price2num($objp->pmp,'MU')).''; + print ''.price(price2num($objp->ppmp,'MU')).''; // Total PMP - print ''.price(price2num($objp->pmp*$objp->value,'MT')).''; - $totalvalue+=price2num($objp->pmp*$objp->value,'MT'); + print ''.price(price2num($objp->ppmp*$objp->value,'MT')).''; + $totalvalue+=price2num($objp->ppmp*$objp->value,'MT'); // Price sell min if (empty($conf->global->PRODUIT_MULTIPRICES)) diff --git a/htdocs/product/stock/valo.php b/htdocs/product/stock/valo.php index 75b85af00fa..93d2f0a9152 100644 --- a/htdocs/product/stock/valo.php +++ b/htdocs/product/stock/valo.php @@ -53,7 +53,7 @@ $year = strftime("%Y",time()); // Affichage valorisation par entrepot $sql = "SELECT e.rowid as ref, e.label, e.statut, e.lieu,"; -$sql.= " SUM(ps.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue"; +$sql.= " SUM(p.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue"; $sql.= " FROM ".MAIN_DB_PREFIX."entrepot as e"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON e.rowid = ps.fk_entrepot"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON ps.fk_product = p.rowid"; From f566b382969841bd32b0d7ba314c73d3e80ecc86 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Thu, 5 Nov 2015 15:29:51 +0100 Subject: [PATCH 10/14] FIX pmp --- htdocs/product/stock/product.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 6b08dd16ecf..a8807c5ea8e 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -578,9 +578,10 @@ if ( (! empty($conf->productbatch->enabled)) && $product->hasbatch()) { print ''; } -$sql = "SELECT e.rowid, e.label, ps.reel, ps.pmp, ps.rowid as product_stock_id"; +$sql = "SELECT e.rowid, e.label, ps.reel, p.pmp, ps.rowid as product_stock_id"; $sql.= " FROM ".MAIN_DB_PREFIX."entrepot as e,"; $sql.= " ".MAIN_DB_PREFIX."product_stock as ps"; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = ps.fk_product"; $sql.= " WHERE ps.reel != 0"; $sql.= " AND ps.fk_entrepot = e.rowid"; $sql.= " AND e.entity IN (".getEntity('stock',1).")"; From 75bcb7e53f2dcb3b71cd7c4e8712b473a36ac2e8 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Thu, 5 Nov 2015 15:32:56 +0100 Subject: [PATCH 11/14] fix pmp --- htdocs/product/stock/product.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 7896476775a..a11e7f355f5 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -528,9 +528,10 @@ print ''.$langs->trans("SellPriceMin").''; print ''.$langs->trans("EstimatedStockValueSellShort").''; print ''; -$sql = "SELECT e.rowid, e.label, ps.reel, ps.pmp"; +$sql = "SELECT e.rowid, e.label, ps.reel, p.pmp"; $sql.= " FROM ".MAIN_DB_PREFIX."entrepot as e,"; $sql.= " ".MAIN_DB_PREFIX."product_stock as ps"; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = ps.fk_product"; $sql.= " WHERE ps.reel != 0"; $sql.= " AND ps.fk_entrepot = e.rowid"; $sql.= " AND e.entity = ".$conf->entity; From ad821358790e17aa2619b3f2aad87be5ad74130a Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Thu, 5 Nov 2015 15:36:13 +0100 Subject: [PATCH 12/14] FIX: change order date on clone (as everywhere else) --- htdocs/commande/class/commande.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 95441e5f257..cda6a9b8d8c 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -906,6 +906,7 @@ class Commande extends CommonOrder // Clear fields $this->user_author_id = $user->id; $this->user_valid = ''; + $this->date = dol_now(); $this->date_creation = ''; $this->date_validation = ''; $this->ref_client = ''; From 80d24455402b65b1519fad1c9f12093b829e5690 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Thu, 5 Nov 2015 17:00:22 +0100 Subject: [PATCH 13/14] FIX: bad stock valorisation --- htdocs/commande/class/commande.class.php | 4 ++-- htdocs/compta/facture/class/facture.class.php | 2 +- htdocs/expedition/class/expedition.class.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 95441e5f257..b2654bfcee7 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -376,7 +376,7 @@ class Commande extends CommonOrder { $mouvP = new MouvementStock($this->db); // We increment stock of product (and sub-products) - $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("OrderBackToDraftInDolibarr",$this->ref)); + $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, 0, $langs->trans("OrderBackToDraftInDolibarr",$this->ref)); if ($result < 0) { $error++; } } } @@ -564,7 +564,7 @@ class Commande extends CommonOrder { $mouvP = new MouvementStock($this->db); // We increment stock of product (and sub-products) - $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("OrderCanceledInDolibarr",$this->ref)); + $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, 0, $langs->trans("OrderCanceledInDolibarr",$this->ref)); if ($result < 0) { $error++; } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 72103f6ac5a..8044a677d69 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1751,7 +1751,7 @@ class Facture extends CommonInvoice $mouvP = new MouvementStock($this->db); $mouvP->origin = &$this; // We decrease stock for product - if ($this->type == self::TYPE_CREDIT_NOTE) $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarr",$num)); + if ($this->type == self::TYPE_CREDIT_NOTE) $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, 0, $langs->trans("InvoiceValidatedInDolibarr",$num)); else $result=$mouvP->livraison($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarr",$num)); if ($result < 0) { $error++; diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 2e591bf67be..e68b063d7d2 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -959,7 +959,7 @@ class Expedition extends CommonObject $mouvS->origin = &$this; // We decrement stock of product (and sub-products) // We use warehouse selected for each line - $result=$mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $obj->qty, $obj->subprice, $langs->trans("ShipmentDeletedInDolibarr",$this->ref)); + $result=$mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $obj->qty, 0, $langs->trans("ShipmentDeletedInDolibarr",$this->ref)); if ($result < 0) { $error++; From 316b7453e47d247ca0af2ae56d8b12bafd86e7b1 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Thu, 5 Nov 2015 17:04:08 +0100 Subject: [PATCH 14/14] FIX bad stock valo --- htdocs/commande/class/commande.class.php | 4 ++-- htdocs/compta/facture/class/facture.class.php | 2 +- htdocs/expedition/class/expedition.class.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 3485d50d729..d4465a43ff5 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -367,7 +367,7 @@ class Commande extends CommonOrder { $mouvP = new MouvementStock($this->db); // We increment stock of product (and sub-products) - $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("OrderBackToDraftInDolibarr",$this->ref)); + $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, 0, $langs->trans("OrderBackToDraftInDolibarr",$this->ref)); if ($result < 0) { $error++; } } } @@ -555,7 +555,7 @@ class Commande extends CommonOrder { $mouvP = new MouvementStock($this->db); // We increment stock of product (and sub-products) - $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("OrderCanceledInDolibarr",$this->ref)); + $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, 0, $langs->trans("OrderCanceledInDolibarr",$this->ref)); if ($result < 0) { $error++; } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 135280805cf..7e1ec7bacf8 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1796,7 +1796,7 @@ class Facture extends CommonInvoice { $mouvP = new MouvementStock($this->db); // We decrease stock for product - if ($this->type == 2) $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarr",$num)); + if ($this->type == 2) $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, 0, $langs->trans("InvoiceValidatedInDolibarr",$num)); else $result=$mouvP->livraison($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarr",$num)); if ($result < 0) { $error++; diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index fa25c48366d..92fb1f0c8a0 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -847,7 +847,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->reception($user, $obj->fk_product, $obj->fk_entrepot, $obj->qty, $obj->subprice, $langs->trans("ShipmentDeletedInDolibarr",$this->ref)); + $result=$mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $obj->qty, 0, $langs->trans("ShipmentDeletedInDolibarr",$this->ref)); if ($result < 0) { $error++;