diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index a980df3e6fc..1caa0c347b4 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -97,11 +97,13 @@ if (empty($reshook)) $backurlforlist = DOL_URL_ROOT.'/bom/bom_list.php'; if (empty($backtopage) || ($cancel && empty($id))) { - //var_dump($backurlforlist);exit; - if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) $backtopage = $backurlforlist; - else $backtopage = DOL_URL_ROOT.'/bom/bom_card.php?id='.($id > 0 ? $id : '__ID__'); + if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) { + if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) $backtopage = $backurlforlist; + else $backtopage = dol_buildpath('/bom/bom_card.php', 1).'?id='.($id > 0 ? $id : '__ID__'); + } } - $triggermodname = 'BOM_MODIFY'; // Name of trigger action code to execute when we modify record + + $triggermodname = 'BOM_MODIFY'; // Name of trigger action code to execute when we modify record // Actions cancel, add, update, delete or clone include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php'; @@ -169,7 +171,9 @@ if (empty($reshook)) } else { - unset($_POST['qty_frozen']); + unset($_POST['idprod']); + unset($_POST['qty']); + unset($_POST['qty_frozen']); unset($_POST['disable_stock_change']); } } @@ -207,7 +211,9 @@ if (empty($reshook)) } else { - unset($_POST['qty_frozen']); + unset($_POST['idprod']); + unset($_POST['qty']); + unset($_POST['qty_frozen']); unset($_POST['disable_stock_change']); } } @@ -644,7 +650,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea { if ($object->status == $object::STATUS_VALIDATED && !empty($user->rights->mrp->write)) { - print 'id).'">'.$langs->trans("CreateMO").''; + print 'id).'">'.$langs->trans("CreateMO").''; } } diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php index b30cc1a411d..59606ee65b5 100644 --- a/htdocs/core/actions_addupdatedelete.inc.php +++ b/htdocs/core/actions_addupdatedelete.inc.php @@ -36,7 +36,12 @@ if ($cancel) { /*var_dump($cancel); var_dump($backtopage);exit;*/ - if (!empty($backtopage)) + if (!empty($backtopageforcancel)) + { + header("Location: ".$backtopageforcancel); + exit; + } + elseif (!empty($backtopage)) { header("Location: ".$backtopage); exit; diff --git a/htdocs/langs/en_US/mrp.lang b/htdocs/langs/en_US/mrp.lang index 6bec44d66e6..faec35f6d46 100644 --- a/htdocs/langs/en_US/mrp.lang +++ b/htdocs/langs/en_US/mrp.lang @@ -54,6 +54,7 @@ ToConsume=To consume ToProduce=To produce QtyAlreadyConsumed=Qty already consumed QtyAlreadyProduced=Qty already produced +ConsumeOrProduce=Consume or Produce ConsumeAndProduceAll=Consume and Produce All Manufactured=Manufactured TheProductXIsAlreadyTheProductToProduce=The product to add is already the product to produce. diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index ecee37908ce..bcdaabb7f6e 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -143,6 +143,7 @@ InventoryCode=Movement or inventory code IsInPackage=Contained into package WarehouseAllowNegativeTransfer=Stock can be negative qtyToTranferIsNotEnough=You don't have enough stock from your source warehouse and your setup does not allow negative stocks. +qtyToTranferLotIsNotEnough=You don't have enough stock, for this lot number, from your source warehouse and your setup does not allow negative stocks (Qty for product '%s' with lot '%s' is %s in warehouse '%s'). ShowWarehouse=Show warehouse MovementCorrectStock=Stock correction for product %s MovementTransferStock=Stock transfer of product %s into another warehouse diff --git a/htdocs/mrp/mo_card.php b/htdocs/mrp/mo_card.php index 68938f97a58..1993f6e46aa 100644 --- a/htdocs/mrp/mo_card.php +++ b/htdocs/mrp/mo_card.php @@ -62,6 +62,7 @@ $confirm = GETPOST('confirm', 'alpha'); $cancel = GETPOST('cancel', 'aZ09'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'mocard'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); +$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); //$lineid = GETPOST('lineid', 'int'); // Initialize technical objects @@ -135,6 +136,10 @@ if (empty($reshook)) else $backtopage = DOL_URL_ROOT.'/mrp/mo_card.php?id='.($id > 0 ? $id : '__ID__'); } } + if ($cancel && ! empty($backtopageforcancel)) { + $backtopage = $backtopageforcancel; + } + $triggermodname = 'MRP_MO_MODIFY'; // Name of trigger action code to execute when we modify record // Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen @@ -202,7 +207,8 @@ if ($action == 'create') print '