From a3cf76cfd7d21d1148b0d457e34f405aed7bbd84 Mon Sep 17 00:00:00 2001 From: jpb Date: Thu, 4 Aug 2022 15:43:14 +0200 Subject: [PATCH 1/2] add token to link --- htdocs/mrp/mo_production.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index f6aba7f2597..65019337b64 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -39,7 +39,7 @@ dol_include_once('/mrp/lib/mrp_mo.lib.php'); // Load translation files required by the page $langs->loadLangs(array("mrp", "stocks", "other", "product", "productbatch")); - +$newToken = function_exists('newToken') ? newToken() : $_SESSION['newtoken']; // Get parameters $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); @@ -257,6 +257,7 @@ if (empty($reshook)) { // Process line to produce $pos = 0; + foreach ($object->lines as $line) { if ($line->role == 'toproduce') { $tmpproduct = new Product($db); @@ -588,7 +589,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($object->status == $object::STATUS_DRAFT) { if ($permissiontoadd) { if (empty($object->table_element_line) || (is_array($object->lines) && count($object->lines) > 0)) { - print ''.$langs->trans("Validate").''; + print ''.$langs->trans("Validate").''; } else { $langs->load("errors"); print ''.$langs->trans("Validate").''; @@ -599,7 +600,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Consume or produce if ($object->status == Mo::STATUS_VALIDATED || $object->status == Mo::STATUS_INPROGRESS) { if ($permissiontoproduce) { - print ''.$langs->trans('ConsumeOrProduce').''; + print ''.$langs->trans('ConsumeOrProduce').''; } else { print ''.$langs->trans('ConsumeOrProduce').''; } @@ -610,7 +611,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // ConsumeAndProduceAll if ($object->status == Mo::STATUS_VALIDATED || $object->status == Mo::STATUS_INPROGRESS) { if ($permissiontoproduce) { - print ''.$langs->trans('ConsumeAndProduceAll').''; + print ''.$langs->trans('ConsumeAndProduceAll').''; } else { print ''.$langs->trans('ConsumeAndProduceAll').''; } @@ -627,21 +628,21 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $nbProduced += $lineproduced['qty']; } if ($nbProduced > 0) { // If production has started, we can close it - print ''.$langs->trans("Close").''."\n"; + print ''.$langs->trans("Close").''."\n"; } else { print 'transnoentitiesnoconv("Production")).'">'.$langs->trans("Close").''."\n"; } - print ''.$langs->trans("Cancel").''."\n"; + print ''.$langs->trans("Cancel").''."\n"; } if ($object->status == $object::STATUS_CANCELED) { - print ''.$langs->trans("Re-Open").''."\n"; + print ''.$langs->trans("Re-Open").''."\n"; } if ($object->status == $object::STATUS_PRODUCED) { if ($permissiontoproduce) { - print ''.$langs->trans('ReOpen').''; + print ''.$langs->trans('ReOpen').''; } else { print ''.$langs->trans('ReOpen').''; } From 630113902792d32ed67c67bc817d30bf4217b066 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Aug 2022 04:42:08 +0200 Subject: [PATCH 2/2] Update mo_production.php --- htdocs/mrp/mo_production.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index 65019337b64..c35dd303dcc 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -39,7 +39,7 @@ dol_include_once('/mrp/lib/mrp_mo.lib.php'); // Load translation files required by the page $langs->loadLangs(array("mrp", "stocks", "other", "product", "productbatch")); -$newToken = function_exists('newToken') ? newToken() : $_SESSION['newtoken']; + // Get parameters $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); @@ -431,6 +431,8 @@ $tmpstockmovement = new MouvementStock($db); $help_url = 'EN:Module_Manufacturing_Orders|FR:Module_Ordres_de_Fabrication'; llxHeader('', $langs->trans('Mo'), $help_url, '', 0, 0, array('/mrp/js/lib_dispatch.js.php')); +$newToken = newToken(); + // Part to show record if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) { $res = $object->fetch_thirdparty();