fix: refs #8069 call moved upper than transaction start #3075
|
@ -98,22 +98,8 @@ BEGIN
|
||||||
SELECT employeeFk INTO vUserFk FROM orderConfig;
|
SELECT employeeFk INTO vUserFk FROM orderConfig;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
START TRANSACTION;
|
|
||||||
|
|
||||||
CALL order_checkEditable(vSelf);
|
|
||||||
|
|
||||||
CALL orderRow_updateOverstocking(vSelf);
|
CALL orderRow_updateOverstocking(vSelf);
|
||||||
|
|
||||||
-- Check order is not empty
|
|
||||||
SELECT COUNT(*) > 0 INTO vHasRows
|
|
||||||
FROM orderRow
|
|
||||||
WHERE orderFk = vSelf
|
|
||||||
AND amount > 0;
|
|
||||||
|
|
||||||
IF NOT vHasRows THEN
|
|
||||||
CALL util.throw('ORDER_EMPTY');
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
-- Check if any product has a quantity of 0
|
-- Check if any product has a quantity of 0
|
||||||
SELECT EXISTS (
|
SELECT EXISTS (
|
||||||
SELECT id
|
SELECT id
|
||||||
|
@ -126,6 +112,20 @@ BEGIN
|
||||||
CALL util.throw('Remove lines with quantity = 0 before confirming');
|
CALL util.throw('Remove lines with quantity = 0 before confirming');
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
|
START TRANSACTION;
|
||||||
|
|
||||||
|
CALL order_checkEditable(vSelf);
|
||||||
|
|
||||||
|
-- Check order is not empty
|
||||||
|
SELECT COUNT(*) > 0 INTO vHasRows
|
||||||
|
FROM orderRow
|
||||||
|
WHERE orderFk = vSelf
|
||||||
|
AND amount > 0;
|
||||||
|
|
||||||
|
IF NOT vHasRows THEN
|
||||||
|
CALL util.throw('ORDER_EMPTY');
|
||||||
|
END IF;
|
||||||
|
|
||||||
-- Crea los tickets del pedido
|
-- Crea los tickets del pedido
|
||||||
OPEN vDates;
|
OPEN vDates;
|
||||||
lDates: LOOP
|
lDates: LOOP
|
||||||
|
|
Loading…
Reference in New Issue