From b6420b639c6374be54c73892909aa2f6a2743cbb Mon Sep 17 00:00:00 2001 From: ivanm Date: Sun, 22 Sep 2024 08:12:59 +0200 Subject: [PATCH] feat: refs #7880 modify hedera.order_confirmWithUser --- .../hedera/procedures/order_confirmWithUser.sql | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/db/routines/hedera/procedures/order_confirmWithUser.sql b/db/routines/hedera/procedures/order_confirmWithUser.sql index 2b033b704..f9280d4d3 100644 --- a/db/routines/hedera/procedures/order_confirmWithUser.sql +++ b/db/routines/hedera/procedures/order_confirmWithUser.sql @@ -111,6 +111,16 @@ BEGIN CALL util.throw('ORDER_EMPTY'); END IF; + -- Check if any product has a quantity of 0 + SELECT COUNT(*) INTO vHasRows + FROM orderRow + WHERE orderFk = vSelf + AND amount = 0; + + IF vHasRows THEN + CALL util.throw('Remove lines with quantity = 0 before confirming'); + END IF; + -- Crea los tickets del pedido OPEN vDates; lDates: LOOP