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 <eldy@destailleur.fr>
This commit is contained in:
atm-lucas 2023-11-20 20:42:27 +01:00 committed by GitHub
parent ca7fe7e29e
commit 73087bee2f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 4 deletions

View file

@ -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.
THMMachineEstimatedHelp=Estimated cost of machine per hour. Will be used to estimate cost of a BOM using this workstation.

View file

@ -127,4 +127,4 @@ BOMServicesList=Les services de BOM
Manufacturing=Fabrication
Disassemble=Déassemblage
ProducedBy=Produit par
QtyTot=Qté totale
QtyTot=Qté totale

View file

@ -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 = '<?php echo dol_escape_js($langs->trans('QtyCantBeSplit')); ?>';
$.jnotify(errormsg, 'error', true);
return -1;
} else if (qtyDispatched >= qtyOrdered) {
window.alert("No remain qty to dispatch");
let errormsg = '<?php echo dol_escape_js($langs->trans('NoRemainQtyToDispatch')); ?>;
$.jnotify(errormsg, 'error', true);
return -1;
} else if (qtyDispatched < qtyOrdered) {
//replace tr suffix nbr