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