From 9a7074d6003de431e992e8489181a79d0b515f7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Mon, 3 Jun 2024 20:16:27 +0200 Subject: [PATCH 1/8] hotfix: ledger_next transacciones refs #7523 --- .../vn/procedures/duaInvoiceInBooking.sql | 2 +- db/routines/vn/procedures/duaTaxBooking.sql | 2 +- .../vn/procedures/invoiceIn_booking.sql | 2 +- .../vn/procedures/invoiceOutBooking.sql | 2 +- .../vn/procedures/ledger_doCompensation.sql | 2 +- db/routines/vn/procedures/ledger_next.sql | 41 ++++--------------- db/routines/vn/procedures/ledger_nextTx.sql | 35 ++++++++++++++++ db/routines/vn/procedures/xdiario_new.sql | 2 +- .../vn/triggers/payment_beforeInsert.sql | 2 +- 9 files changed, 50 insertions(+), 40 deletions(-) create mode 100644 db/routines/vn/procedures/ledger_nextTx.sql diff --git a/db/routines/vn/procedures/duaInvoiceInBooking.sql b/db/routines/vn/procedures/duaInvoiceInBooking.sql index 035b4eab1..8b4df6a73 100644 --- a/db/routines/vn/procedures/duaInvoiceInBooking.sql +++ b/db/routines/vn/procedures/duaInvoiceInBooking.sql @@ -44,7 +44,7 @@ BEGIN JOIN dua d ON d.id = de.duaFk WHERE d.id = vDuaFk LIMIT 1; - CALL ledger_next(vFiscalYear, FALSE, vBookEntry); + CALL ledger_nextTx(vFiscalYear, vBookEntry); END IF; OPEN vInvoicesIn; diff --git a/db/routines/vn/procedures/duaTaxBooking.sql b/db/routines/vn/procedures/duaTaxBooking.sql index 8d8effe90..a50a10ca4 100644 --- a/db/routines/vn/procedures/duaTaxBooking.sql +++ b/db/routines/vn/procedures/duaTaxBooking.sql @@ -12,7 +12,7 @@ BEGIN WHERE id = vDuaFk; IF vBookNumber IS NULL OR NOT vBookNumber THEN - CALL ledger_next(YEAR(vBookDated), FALSE, vBookNumber); + CALL ledger_nextTx(YEAR(vBookDated), vBookNumber); END IF; -- Apunte de la aduana diff --git a/db/routines/vn/procedures/invoiceIn_booking.sql b/db/routines/vn/procedures/invoiceIn_booking.sql index cd311ba9d..ef124bb46 100644 --- a/db/routines/vn/procedures/invoiceIn_booking.sql +++ b/db/routines/vn/procedures/invoiceIn_booking.sql @@ -70,7 +70,7 @@ BEGIN SELECT YEAR(bookEntried) INTO vFiscalYear FROM tInvoiceIn LIMIT 1; IF vBookNumber IS NULL THEN - CALL ledger_next(vFiscalYear, FALSE, vBookNumber); + CALL ledger_nextTx(vFiscalYear, vBookNumber); END IF; -- Apunte del proveedor diff --git a/db/routines/vn/procedures/invoiceOutBooking.sql b/db/routines/vn/procedures/invoiceOutBooking.sql index b50b89eaf..9fc1c92b6 100644 --- a/db/routines/vn/procedures/invoiceOutBooking.sql +++ b/db/routines/vn/procedures/invoiceOutBooking.sql @@ -61,7 +61,7 @@ BEGIN WHERE io.id = vInvoice; SELECT YEAR(FECHA) INTO vFiscalYear FROM rs LIMIT 1; - CALL ledger_next(vFiscalYear, FALSE, vBookNumber); + CALL ledger_nextTx(vFiscalYear, vBookNumber); -- Linea del cliente INSERT INTO XDiario( ASIEN, diff --git a/db/routines/vn/procedures/ledger_doCompensation.sql b/db/routines/vn/procedures/ledger_doCompensation.sql index a9e4e4251..391575bac 100644 --- a/db/routines/vn/procedures/ledger_doCompensation.sql +++ b/db/routines/vn/procedures/ledger_doCompensation.sql @@ -28,7 +28,7 @@ BEGIN DECLARE vIsOriginalAClient BOOL; DECLARE vPayMethodCompensation INT; - CALL ledger_next(YEAR(vDated), FALSE, vNewBookEntry); + CALL ledger_nextTx(YEAR(vDated), vNewBookEntry); SELECT COUNT(id) INTO vIsOriginalAClient FROM client diff --git a/db/routines/vn/procedures/ledger_next.sql b/db/routines/vn/procedures/ledger_next.sql index 2d565ff99..0a390ab16 100644 --- a/db/routines/vn/procedures/ledger_next.sql +++ b/db/routines/vn/procedures/ledger_next.sql @@ -1,38 +1,21 @@ DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ledger_next`( IN vFiscalYear INT, - IN vIsManageTransaction BOOLEAN, OUT vLastBookEntry INT ) +/** + * Devuelve un número de asiento válido, según el contador de asientos + * tabla vn.ledgerConfig, si no existe lo inicializa a 1 + * No inicia transacción, para transaccionar usar vn.ledger_nextTx + * + * @param vFiscalYear Id del año contable + * @return vLastBookEntry Id del asiento + */ BEGIN - DECLARE vHasStartTransaction BOOLEAN; - - DECLARE EXIT HANDLER FOR SQLEXCEPTION - BEGIN - - IF vHasStartTransaction THEN - ROLLBACK TO sp; - RESIGNAL; - ELSE - ROLLBACK; - CALL util.throw ('It has not been possible to generate a new ledger'); - END IF; - END; - IF vFiscalYear IS NULL THEN CALL util.throw('Fiscal year is required'); END IF; - IF NOT vIsManageTransaction THEN - SELECT @@in_transaction INTO vHasStartTransaction; - - IF NOT vHasStartTransaction THEN - START TRANSACTION; - ELSE - SAVEPOINT sp; - END IF; - END IF; - SELECT bookEntry + 1 INTO vLastBookEntry FROM ledgerCompany WHERE fiscalYear = vFiscalYear @@ -48,13 +31,5 @@ BEGIN UPDATE ledgerCompany SET bookEntry = vLastBookEntry WHERE fiscalYear = vFiscalYear; - - IF NOT vIsManageTransaction THEN - IF vHasStartTransaction THEN - RELEASE SAVEPOINT sp; - ELSE - COMMIT; - END IF; - END IF; END$$ DELIMITER ; \ No newline at end of file diff --git a/db/routines/vn/procedures/ledger_nextTx.sql b/db/routines/vn/procedures/ledger_nextTx.sql new file mode 100644 index 000000000..bdc0c3360 --- /dev/null +++ b/db/routines/vn/procedures/ledger_nextTx.sql @@ -0,0 +1,35 @@ +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ledger_nextTx`( + IN vFiscalYear INT, + OUT vLastBookEntry INT +) +/** + * Devuelve un número de asiento válido, según el contador de asientos + * tabla vn.ledgerConfig, si no existe lo inicializa a 1 + * Lo hace transaccionando el proceso + * + * @param vFiscalYear Id del año contable + * @return vLastBookEntry Id del asiento + */ +BEGIN + DECLARE EXIT HANDLER FOR SQLEXCEPTION + BEGIN + ROLLBACK; + RESIGNAL; + END; + + IF vFiscalYear IS NULL THEN + CALL util.throw('Fiscal year is required'); + END IF; + + IF @@in_transaction THEN + CALL util.throw('This procedure should not be executed within a transaction'); + END IF; + + START TRANSACTION; + + CALL ledger_next(vFiscalYear, vLastBookEntry); + + COMMIT; +END$$ +DELIMITER ; \ No newline at end of file diff --git a/db/routines/vn/procedures/xdiario_new.sql b/db/routines/vn/procedures/xdiario_new.sql index 83e1afa16..22a26184e 100644 --- a/db/routines/vn/procedures/xdiario_new.sql +++ b/db/routines/vn/procedures/xdiario_new.sql @@ -39,7 +39,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`xdiario_new`( */ BEGIN IF vBookNumber IS NULL THEN - CALL ledger_next(YEAR(vDated), FALSE, vBookNumber); + CALL ledger_nextTx(YEAR(vDated), vBookNumber); END IF; INSERT INTO XDiario diff --git a/db/routines/vn/triggers/payment_beforeInsert.sql b/db/routines/vn/triggers/payment_beforeInsert.sql index 337a54172..af369a69b 100644 --- a/db/routines/vn/triggers/payment_beforeInsert.sql +++ b/db/routines/vn/triggers/payment_beforeInsert.sql @@ -23,7 +23,7 @@ BEGIN FROM supplier WHERE id = NEW.supplierFk; - CALL ledger_next(YEAR(NEW.received), TRUE, vNewBookEntry); + CALL ledger_next(YEAR(NEW.received), vNewBookEntry); INSERT INTO XDiario ( ASIEN, From 1927fbce4561f6c0e90a23398acb72d02cf80746 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Tue, 4 Jun 2024 15:39:02 +0200 Subject: [PATCH 2/8] hotfix: ledger_next transacciones refs #7523 --- back/tests.js | 4 ++-- db/.pullinfo.json | 2 +- db/routines/util/procedures/tx_commit.sql | 2 +- db/routines/util/procedures/tx_rollback.sql | 3 ++- db/routines/util/procedures/tx_start.sql | 2 +- db/routines/vn/procedures/ledger_nextTx.sql | 13 ++++--------- .../back/methods/travel/cloneWithEntries.js | 19 ++++++++++--------- .../travel/specs/cloneWithEntries.spec.js | 18 ++++++++---------- 8 files changed, 29 insertions(+), 34 deletions(-) diff --git a/back/tests.js b/back/tests.js index 50698eb92..fba3df4a8 100644 --- a/back/tests.js +++ b/back/tests.js @@ -98,8 +98,8 @@ async function test() { const SpecReporter = require('jasmine-spec-reporter').SpecReporter; runner.addReporter(new SpecReporter({ spec: { - displaySuccessful: opts.ci, - displayPending: opts.ci + displaySuccessful: true, + displayPending: true }, summary: { displayPending: false, diff --git a/db/.pullinfo.json b/db/.pullinfo.json index 0defed845..27d2c7535 100644 --- a/db/.pullinfo.json +++ b/db/.pullinfo.json @@ -9,7 +9,7 @@ }, "vn": { "view": { - "expeditionPallet_Print": "06613719475fcdba8309607c38cc78efc2e348cca7bc96b48dc3ae3c12426f54" + "expeditionPallet_Print": "ced2b84a114fcb99fce05f0c34f4fc03f3fa387bef92621be1bc306608a84345" } } } diff --git a/db/routines/util/procedures/tx_commit.sql b/db/routines/util/procedures/tx_commit.sql index fdf2f3ddb..8eb0c7426 100644 --- a/db/routines/util/procedures/tx_commit.sql +++ b/db/routines/util/procedures/tx_commit.sql @@ -6,7 +6,7 @@ BEGIN * * @param isTx es true si existe transacción asociada */ - IF isTx THEN + IF NOT isTx THEN COMMIT; END IF; END$$ diff --git a/db/routines/util/procedures/tx_rollback.sql b/db/routines/util/procedures/tx_rollback.sql index 96571af2c..e2c089f64 100644 --- a/db/routines/util/procedures/tx_rollback.sql +++ b/db/routines/util/procedures/tx_rollback.sql @@ -6,8 +6,9 @@ BEGIN * * @param isTx es true si existe transacción asociada */ - IF isTx THEN + IF NOT isTx THEN ROLLBACK; + RESIGNAL; END IF; END$$ DELIMITER ; diff --git a/db/routines/util/procedures/tx_start.sql b/db/routines/util/procedures/tx_start.sql index 9d9f16bb7..aa410ff72 100644 --- a/db/routines/util/procedures/tx_start.sql +++ b/db/routines/util/procedures/tx_start.sql @@ -6,7 +6,7 @@ BEGIN * * @param isTx es true si existe transacción asociada */ - IF isTx THEN + IF NOT isTx THEN START TRANSACTION; END IF; END$$ diff --git a/db/routines/vn/procedures/ledger_nextTx.sql b/db/routines/vn/procedures/ledger_nextTx.sql index bdc0c3360..abe96a21e 100644 --- a/db/routines/vn/procedures/ledger_nextTx.sql +++ b/db/routines/vn/procedures/ledger_nextTx.sql @@ -12,24 +12,19 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ledger_nextTx`( * @return vLastBookEntry Id del asiento */ BEGIN + DECLARE vhasTx BOOL DEFAULT @@in_transaction; DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN - ROLLBACK; + CALL util.tx_rollback(vhasTx); RESIGNAL; END; IF vFiscalYear IS NULL THEN CALL util.throw('Fiscal year is required'); END IF; - - IF @@in_transaction THEN - CALL util.throw('This procedure should not be executed within a transaction'); - END IF; - - START TRANSACTION; + CALL util.tx_start(vhasTx); CALL ledger_next(vFiscalYear, vLastBookEntry); - - COMMIT; + CALL util.tx_commit(vhasTx); END$$ DELIMITER ; \ No newline at end of file diff --git a/modules/travel/back/methods/travel/cloneWithEntries.js b/modules/travel/back/methods/travel/cloneWithEntries.js index e5eb0b06c..12afad6e2 100644 --- a/modules/travel/back/methods/travel/cloneWithEntries.js +++ b/modules/travel/back/methods/travel/cloneWithEntries.js @@ -26,18 +26,17 @@ module.exports = Self => { Self.cloneWithEntries = async(ctx, id, options) => { const conn = Self.dataSource.connector; + let tx; const myOptions = {}; - let tx = options?.transaction; + if (typeof options == 'object') + Object.assign(myOptions, options); + + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; + } try { - if (typeof options == 'object') - Object.assign(myOptions, options); - - if (!myOptions.transaction) { - tx = await Self.beginTransaction({}); - myOptions.transaction = tx; - } - const travel = await Self.findById(id, { fields: [ 'id', @@ -89,6 +88,8 @@ module.exports = Self => { 'ref' ] }, myOptions); + + if (tx) await tx.commit(); return newTravel.id; } catch (e) { if (tx) await tx.rollback(); diff --git a/modules/travel/back/methods/travel/specs/cloneWithEntries.spec.js b/modules/travel/back/methods/travel/specs/cloneWithEntries.spec.js index 950da7bb1..8b3638db9 100644 --- a/modules/travel/back/methods/travel/specs/cloneWithEntries.spec.js +++ b/modules/travel/back/methods/travel/specs/cloneWithEntries.spec.js @@ -7,19 +7,22 @@ describe('Travel cloneWithEntries()', () => { const ctx = {req: {accessToken: {userId: currentUserId}}}; let newTravelId; it(`should clone the travel and the containing entries`, async() => { - const tx = await models.Travel.beginTransaction({ - }); + const tx = await models.Travel.beginTransaction({}); const warehouseThree = 3; const agencyModeOne = 1; + let travelRemoved; + try { const options = {transaction: tx}; + newTravelId = await models.Travel.cloneWithEntries(ctx, travelId, options); const travelEntries = await models.Entry.find({ where: { travelFk: newTravelId } }, options); - const newTravel = await models.Travel.findById(travelId); + const newTravel = await models.Travel.findById(travelId, null, options); + travelRemoved = await models.Travel.findById(newTravelId); expect(newTravelId).not.toEqual(travelId); expect(newTravel.ref).toEqual('fifth travel'); @@ -27,14 +30,9 @@ describe('Travel cloneWithEntries()', () => { expect(newTravel.warehouseOutFk).toEqual(warehouseThree); expect(newTravel.agencyModeFk).toEqual(agencyModeOne); expect(travelEntries.length).toBeGreaterThan(0); - await models.Entry.destroyAll({ - travelFk: newTravelId - }, options); - await models.Travel.destroyById(newTravelId, options); - await tx.rollback(); - const travelRemoved = await models.Travel.findById(newTravelId, options); - expect(travelRemoved).toBeNull(); + + await tx.rollback(); } catch (e) { if (tx) await tx.rollback(); throw e; From c57f4db623c4bb8c7f667a7a1adc59d016028057 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Tue, 4 Jun 2024 15:41:53 +0200 Subject: [PATCH 3/8] hotfix: ledger_next transacciones refs #7523 --- db/.pullinfo.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/.pullinfo.json b/db/.pullinfo.json index 27d2c7535..0defed845 100644 --- a/db/.pullinfo.json +++ b/db/.pullinfo.json @@ -9,7 +9,7 @@ }, "vn": { "view": { - "expeditionPallet_Print": "ced2b84a114fcb99fce05f0c34f4fc03f3fa387bef92621be1bc306608a84345" + "expeditionPallet_Print": "06613719475fcdba8309607c38cc78efc2e348cca7bc96b48dc3ae3c12426f54" } } } From e2adadb8da542398b7a3689906a4bacd4b52a7d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Tue, 4 Jun 2024 15:43:32 +0200 Subject: [PATCH 4/8] hotfix: ledger_next transacciones refs #7523 --- back/tests.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/back/tests.js b/back/tests.js index fba3df4a8..50698eb92 100644 --- a/back/tests.js +++ b/back/tests.js @@ -98,8 +98,8 @@ async function test() { const SpecReporter = require('jasmine-spec-reporter').SpecReporter; runner.addReporter(new SpecReporter({ spec: { - displaySuccessful: true, - displayPending: true + displaySuccessful: opts.ci, + displayPending: opts.ci }, summary: { displayPending: false, From a9eb5f7d1ef9cc325b1ab10a23b93610dd35667b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Tue, 4 Jun 2024 15:45:54 +0200 Subject: [PATCH 5/8] hotfix: ledger_next transacciones refs #7523 --- db/routines/util/procedures/tx_rollback.sql | 1 - 1 file changed, 1 deletion(-) diff --git a/db/routines/util/procedures/tx_rollback.sql b/db/routines/util/procedures/tx_rollback.sql index e2c089f64..8909a96bb 100644 --- a/db/routines/util/procedures/tx_rollback.sql +++ b/db/routines/util/procedures/tx_rollback.sql @@ -8,7 +8,6 @@ BEGIN */ IF NOT isTx THEN ROLLBACK; - RESIGNAL; END IF; END$$ DELIMITER ; From e4969f70616391f261cfced2107e05f78c530977 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Tue, 4 Jun 2024 16:43:09 +0200 Subject: [PATCH 6/8] Hotfix: ledger_next transacciones refs #7523 --- db/routines/util/procedures/tx_commit.sql | 6 +++--- db/routines/util/procedures/tx_rollback.sql | 4 ++-- db/routines/util/procedures/tx_start.sql | 6 +++--- db/routines/vn/procedures/ledger_nextTx.sql | 8 ++++---- db/routines/vn/procedures/travel_cloneWithEntries.sql | 10 +++++----- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/db/routines/util/procedures/tx_commit.sql b/db/routines/util/procedures/tx_commit.sql index 8eb0c7426..35f96df8d 100644 --- a/db/routines/util/procedures/tx_commit.sql +++ b/db/routines/util/procedures/tx_commit.sql @@ -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$$ diff --git a/db/routines/util/procedures/tx_rollback.sql b/db/routines/util/procedures/tx_rollback.sql index 8909a96bb..82f771024 100644 --- a/db/routines/util/procedures/tx_rollback.sql +++ b/db/routines/util/procedures/tx_rollback.sql @@ -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$$ diff --git a/db/routines/util/procedures/tx_start.sql b/db/routines/util/procedures/tx_start.sql index aa410ff72..41f8c94ee 100644 --- a/db/routines/util/procedures/tx_start.sql +++ b/db/routines/util/procedures/tx_start.sql @@ -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$$ diff --git a/db/routines/vn/procedures/ledger_nextTx.sql b/db/routines/vn/procedures/ledger_nextTx.sql index abe96a21e..98c157676 100644 --- a/db/routines/vn/procedures/ledger_nextTx.sql +++ b/db/routines/vn/procedures/ledger_nextTx.sql @@ -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 ; \ No newline at end of file diff --git a/db/routines/vn/procedures/travel_cloneWithEntries.sql b/db/routines/vn/procedures/travel_cloneWithEntries.sql index 7cf9ee5ef..c51a68ecd 100644 --- a/db/routines/vn/procedures/travel_cloneWithEntries.sql +++ b/db/routines/vn/procedures/travel_cloneWithEntries.sql @@ -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 ; From 35b4255505e0584525785774118282c5c12b7b68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Tue, 4 Jun 2024 16:45:42 +0200 Subject: [PATCH 7/8] Hotfix: ledger_next transacciones refs #7523 --- db/routines/util/procedures/tx_rollback.sql | 2 +- db/routines/vn/procedures/travel_cloneWithEntries.sql | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/db/routines/util/procedures/tx_rollback.sql b/db/routines/util/procedures/tx_rollback.sql index 82f771024..4b00f9ec1 100644 --- a/db/routines/util/procedures/tx_rollback.sql +++ b/db/routines/util/procedures/tx_rollback.sql @@ -4,7 +4,7 @@ BEGIN /** * Deshace 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 vIsTx THEN ROLLBACK; diff --git a/db/routines/vn/procedures/travel_cloneWithEntries.sql b/db/routines/vn/procedures/travel_cloneWithEntries.sql index c51a68ecd..e2d086fc8 100644 --- a/db/routines/vn/procedures/travel_cloneWithEntries.sql +++ b/db/routines/vn/procedures/travel_cloneWithEntries.sql @@ -24,8 +24,8 @@ BEGIN DECLARE vEvaNotes VARCHAR(255); DECLARE vDone BOOL; DECLARE vAuxEntryFk INT; - DECLARE vDoTx BOOLEAN DEFAULT NOT @@in_transaction; - DECLARE vIsRequiredTx CURSOR FOR + DECLARE vIsRequiredTx BOOLEAN DEFAULT NOT @@in_transaction; + DECLARE vRsEntry CURSOR FOR SELECT e.id FROM entry e JOIN travel t ON t.id = e.travelFk From 3b4cbe9e6c7b4a4860fbe6dd2b9703dcf8e9c6aa Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 4 Jun 2024 22:59:33 +0200 Subject: [PATCH 8/8] ci(Jenkinsfile): refs #7442 Remove ci from back tests --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index d3dbfeddb..7dccdd0b5 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -102,7 +102,7 @@ pipeline { NODE_ENV = '' } steps { - sh 'node back/tests.js --ci --junit --network jenkins' + sh 'node back/tests.js --junit' } post { always {