Merge pull request #25640 from altairisfr/checkqtyshipped

NEW : add constant to check if qty shipped not greater than qty ordered
This commit is contained in:
Laurent Destailleur 2023-08-19 12:16:29 +02:00 committed by GitHub
commit 70a36bd38b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View file

@ -334,6 +334,7 @@ if (empty($reshook)) {
$stockLine[$i][$j]['ix_l'] = GETPOST($idl, 'int');
$totalqty += price2num(GETPOST($qty, 'alpha'), 'MS');
$subtotalqty += price2num(GETPOST($qty, 'alpha'), 'MS');
$j++;
$stockLocation = "ent1".$i."_".$j;
@ -343,9 +344,17 @@ if (empty($reshook)) {
//shipment line for product with no batch management and no multiple stock location
if (GETPOST($qty, 'int') > 0) {
$totalqty += price2num(GETPOST($qty, 'alpha'), 'MS');
$subtotalqty = price2num(GETPOST($qty, 'alpha'), 'MS');
}
}
// check qty shipped not greater than ordered
if (getDolGlobalInt("MAIN_DONT_SHIP_MORE_THAN_ORDERED") && $subtotalqty > $objectsrc->lines[$i]->qty) {
setEventMessages($langs->trans("ErrorTooMuchShipped", $i+1), null, 'errors');
$error++;
continue;
}
// Extrafields
$array_options[$i] = $extrafields->getOptionalsFromPost($object->table_element_line, $i);
// Unset extrafield

View file

@ -78,4 +78,6 @@ DetailWarehouseFormat= W:%s (Qty: %d)
ShipmentDistribution=Shipment distribution
ErrorTooManyCombinationBatchcode=No dispatch for line %s as too many combination warehouse, product, batch code was found (%s).
ErrorNoCombinationBatchcode=No dispatch for line %s as no combination warehouse, product, batch code was found.
ErrorNoCombinationBatchcode=No dispatch for line %s as no combination warehouse, product, batch code was found.
ErrorTooMuchShipped=Quantity shipped should not be greater than quantity ordered for line %s