From 20836d734c6fdcdd8714e9d2f6b8fc6c4675f2b3 Mon Sep 17 00:00:00 2001 From: Pako Date: Mon, 7 Oct 2024 14:25:46 +0200 Subject: [PATCH] fix: refs #8069 order_confirmWithUser --- .../hedera/procedures/order_confirmWithUser.sql | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/db/routines/hedera/procedures/order_confirmWithUser.sql b/db/routines/hedera/procedures/order_confirmWithUser.sql index 2b033b704..a0c5c5667 100644 --- a/db/routines/hedera/procedures/order_confirmWithUser.sql +++ b/db/routines/hedera/procedures/order_confirmWithUser.sql @@ -13,6 +13,7 @@ BEGIN */ DECLARE vHasRows BOOL; DECLARE vDone BOOL; + DECLARE vHas0Amount BOOL; DECLARE vWarehouseFk INT; DECLARE vShipment DATE; DECLARE vShipmentDayEnd DATETIME; @@ -97,6 +98,20 @@ BEGIN SELECT employeeFk INTO vUserFk FROM orderConfig; END IF; + CALL orderRow_updateOverstocking(vSelf); + + -- Check if any product has a quantity of 0 + SELECT EXISTS ( + SELECT id + FROM orderRow + WHERE orderFk = vSelf + AND amount = 0 + ) INTO vHas0Amount; + + IF vHas0Amount THEN + CALL util.throw('Remove lines with quantity = 0 before confirming'); + END IF; + START TRANSACTION; CALL order_checkEditable(vSelf);