diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 7f948153e10..f34cc2d11a5 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -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 diff --git a/htdocs/langs/en_US/sendings.lang b/htdocs/langs/en_US/sendings.lang index 84f85fb13b4..6ed59b35e89 100644 --- a/htdocs/langs/en_US/sendings.lang +++ b/htdocs/langs/en_US/sendings.lang @@ -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. \ No newline at end of file +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