Hotfix: ledger_next transacciones refs #7523
gitea/salix/pipeline/pr-master There was a failure building this commit Details

This commit is contained in:
Carlos Andrés 2024-06-04 16:43:09 +02:00
parent a9eb5f7d1e
commit e4969f7061
5 changed files with 17 additions and 17 deletions

View File

@ -1,12 +1,12 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `util`.`tx_commit`(isTx BOOL)
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `util`.`tx_commit`(vIsTx BOOL)
BEGIN
/**
* Confirma los cambios asociados a una transacción.
*
* @param isTx es true si existe transacción asociada
* @param vIsTx es true si existe transacción asociada
*/
IF NOT isTx THEN
IF vIsTx THEN
COMMIT;
END IF;
END$$

View File

@ -1,12 +1,12 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `util`.`tx_rollback`(isTx BOOL)
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `util`.`tx_rollback`(vIsTx BOOL)
BEGIN
/**
* Deshace los cambios asociados a una transacción.
*
* @param isTx es true si existe transacción asociada
*/
IF NOT isTx THEN
IF vIsTx THEN
ROLLBACK;
END IF;
END$$

View File

@ -1,12 +1,12 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `util`.`tx_start`(isTx BOOL)
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `util`.`tx_start`(vIsTx BOOL)
BEGIN
/**
* Inicia una transacción.
*
* @param isTx es true si existe transacción asociada
* @param vIsTx es true si existe transacción asociada
*/
IF NOT isTx THEN
IF vIsTx THEN
START TRANSACTION;
END IF;
END$$

View File

@ -12,10 +12,10 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ledger_nextTx`(
* @return vLastBookEntry Id del asiento
*/
BEGIN
DECLARE vhasTx BOOL DEFAULT @@in_transaction;
DECLARE vIsRequiredTx BOOL DEFAULT NOT @@in_transaction;
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
CALL util.tx_rollback(vhasTx);
CALL util.tx_rollback(vIsRequiredTx);
RESIGNAL;
END;
@ -23,8 +23,8 @@ BEGIN
CALL util.throw('Fiscal year is required');
END IF;
CALL util.tx_start(vhasTx);
CALL util.tx_start(vIsRequiredTx);
CALL ledger_next(vFiscalYear, vLastBookEntry);
CALL util.tx_commit(vhasTx);
CALL util.tx_commit(vIsRequiredTx);
END$$
DELIMITER ;

View File

@ -24,8 +24,8 @@ BEGIN
DECLARE vEvaNotes VARCHAR(255);
DECLARE vDone BOOL;
DECLARE vAuxEntryFk INT;
DECLARE vTx BOOLEAN DEFAULT @@in_transaction;
DECLARE vRsEntry CURSOR FOR
DECLARE vDoTx BOOLEAN DEFAULT NOT @@in_transaction;
DECLARE vIsRequiredTx CURSOR FOR
SELECT e.id
FROM entry e
JOIN travel t ON t.id = e.travelFk
@ -35,11 +35,11 @@ BEGIN
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
CALL util.tx_rollback(vTx);
CALL util.tx_rollback(vIsRequiredTx);
RESIGNAL;
END;
CALL util.tx_start(vTx);
CALL util.tx_start(vIsRequiredTx);
INSERT INTO travel (shipped, landed, warehouseInFk, warehouseOutFk, agencyModeFk, `ref`, isDelivered, isReceived, m3, cargoSupplierFk, kg,clonedFrom)
SELECT vDateStart, vDateEnd, vWarehouseInFk, vWarehouseOutFk, vAgencyModeFk, vRef, isDelivered, isReceived, m3,cargoSupplierFk, kg,vTravelFk
@ -76,6 +76,6 @@ BEGIN
SET @isModeInventory = FALSE;
CLOSE vRsEntry;
CALL util.tx_commit(vTx);
CALL util.tx_commit(vIsRequiredTx);
END$$
DELIMITER ;