From 73087bee2fd70b9d1d49e268df3700b749e1b407 Mon Sep 17 00:00:00 2001 From: atm-lucas <121817516+atm-lucasmantegari@users.noreply.github.com> Date: Mon, 20 Nov 2023 20:42:27 +0100 Subject: [PATCH] FIX - change error message on quantity (#26606) * Added a new error message on quantity split * fault correction * Add loading translation files * Fault * Translation key * Code correction --------- Co-authored-by: Laurent Destailleur --- htdocs/langs/en_US/mrp.lang | 7 ++++++- htdocs/langs/fr_FR/mrp.lang | 2 +- htdocs/mrp/js/lib_dispatch.js.php | 9 +++++++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/htdocs/langs/en_US/mrp.lang b/htdocs/langs/en_US/mrp.lang index 55d002b2554..935995ea3ae 100644 --- a/htdocs/langs/en_US/mrp.lang +++ b/htdocs/langs/en_US/mrp.lang @@ -128,5 +128,10 @@ Manufacturing=Manufacturing Disassemble=Disassemble ProducedBy=Produced by QtyTot=Qty Total + +QtyCantBeSplit= Quantity cannot be split +NoRemainQtyToDispatch=No quantity remaining to divide + THMOperatorEstimatedHelp=Estimated cost of operator per hour. Will be used to estimate cost of a BOM using this workstation. -THMMachineEstimatedHelp=Estimated cost of machine per hour. Will be used to estimate cost of a BOM using this workstation. \ No newline at end of file +THMMachineEstimatedHelp=Estimated cost of machine per hour. Will be used to estimate cost of a BOM using this workstation. + diff --git a/htdocs/langs/fr_FR/mrp.lang b/htdocs/langs/fr_FR/mrp.lang index b9e43ce69db..0236c90550f 100644 --- a/htdocs/langs/fr_FR/mrp.lang +++ b/htdocs/langs/fr_FR/mrp.lang @@ -127,4 +127,4 @@ BOMServicesList=Les services de BOM Manufacturing=Fabrication Disassemble=Déassemblage ProducedBy=Produit par -QtyTot=Qté totale +QtyTot=Qté totale \ No newline at end of file diff --git a/htdocs/mrp/js/lib_dispatch.js.php b/htdocs/mrp/js/lib_dispatch.js.php index 1dd2d9d164c..27cc38f988c 100644 --- a/htdocs/mrp/js/lib_dispatch.js.php +++ b/htdocs/mrp/js/lib_dispatch.js.php @@ -47,6 +47,9 @@ session_cache_limiter('public'); require_once '../../main.inc.php'; +// Load translation files required by the page +$langs->loadLangs(array("mrp")); + // Define javascript type top_httphead('text/javascript; charset=UTF-8'); // Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access. @@ -153,10 +156,12 @@ function addDispatchLine(index, type, mode) */ function addDispatchTR(qtyOrdered, qtyDispatched, index, nbrTrs, warehouseId, inputId, type, qty, mode, $row) { if (qtyOrdered <= 1) { - window.alert("Quantity can't be split"); + let errormsg = 'trans('QtyCantBeSplit')); ?>'; + $.jnotify(errormsg, 'error', true); return -1; } else if (qtyDispatched >= qtyOrdered) { - window.alert("No remain qty to dispatch"); + let errormsg = 'trans('NoRemainQtyToDispatch')); ?>; + $.jnotify(errormsg, 'error', true); return -1; } else if (qtyDispatched < qtyOrdered) { //replace tr suffix nbr