From d53772f21d6422514c338df4a694fb202bd3c3e4 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Thu, 17 Aug 2023 11:11:49 +0200 Subject: [PATCH] add constant to check if qty shipped not greater than qty ordered --- htdocs/expedition/card.php | 7 +++++++ htdocs/langs/en_US/sendings.lang | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 7f948153e10..f98dd26816f 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -346,6 +346,13 @@ if (empty($reshook)) { } } + // check qty shipped not greater than ordered + if (dolGetGlobalInt("ErrorTooMuchShipped") && $totalqty > $objectsrc->lines[$i]->qty) { + setEventMessages($langs->trans("", $i), 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