fix: refs #6861 fixTransactionCommit #3139
|
@ -20,6 +20,7 @@ proc: BEGIN
|
|||
DECLARE vUserFk INT;
|
||||
DECLARE vTotalReservedQuantity INT;
|
||||
DECLARE vSaleQuantity INT;
|
||||
DECLARE vIsRequiredTx BOOL DEFAULT NOT @@in_transaction;
|
||||
|
||||
DECLARE vItemShelvingAvailable CURSOR FOR
|
||||
SELECT ish.id itemShelvingFk,
|
||||
|
@ -44,11 +45,11 @@ proc: BEGIN
|
|||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||
BEGIN
|
||||
ROLLBACK;
|
||||
CALL util.tx_rollback(vIsRequiredTx);
|
||||
RESIGNAL;
|
||||
END;
|
||||
|
||||
START TRANSACTION;
|
||||
CALL util.tx_start(vIsRequiredTx);
|
||||
|
||||
SELECT id INTO vSaleFk
|
||||
FROM sale
|
||||
|
@ -65,7 +66,7 @@ proc: BEGIN
|
|||
WHERE s.id = vSaleFk;
|
||||
|
||||
IF vOutStanding <= 0 THEN
|
||||
COMMIT;
|
||||
CALL util.tx_commit(vIsRequiredTx);
|
||||
LEAVE proc;
|
||||
END IF;
|
||||
|
||||
|
@ -123,6 +124,6 @@ proc: BEGIN
|
|||
END IF;
|
||||
END LOOP;
|
||||
CLOSE vItemShelvingAvailable;
|
||||
COMMIT;
|
||||
CALL util.tx_commit(vIsRequiredTx);
|
||||
END$$
|
||||
DELIMITER ;
|
Loading…
Reference in New Issue