From d497ffc781c68e5be4a060ee442ab3ffeca6dd5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Tue, 8 Oct 2024 13:32:57 +0000 Subject: [PATCH 1/4] Actualizar modules/ticket/back/methods/ticket/closure.js --- modules/ticket/back/methods/ticket/closure.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/ticket/back/methods/ticket/closure.js b/modules/ticket/back/methods/ticket/closure.js index a75596bac..945406ab4 100644 --- a/modules/ticket/back/methods/ticket/closure.js +++ b/modules/ticket/back/methods/ticket/closure.js @@ -22,6 +22,8 @@ module.exports = async function(ctx, Self, tickets, options) { const failedtickets = []; for (const ticket of tickets) { try { + await Self.rawSql(`CALL util.debugAdd('invoicingTicket', ?)`, [ticket.id], {userId}); + await Self.app.models.InvoiceOut.getSerial(ticket.clientFk, ticket.companyFk, ticket.addressFk, 'quick'); await Self.rawSql( `CALL vn.ticket_closeByTicket(?)`, @@ -149,6 +151,11 @@ module.exports = async function(ctx, Self, tickets, options) { myOptions); } } catch (error) { + await Self.rawSql(` + INSERT INTO util.debug (variable, value) + VALUES ('invoicingTicketError', ?) + `, [ticket.id + ' - ' + error]); + if (error.responseCode == 450) { await invalidEmail(ticket); continue; From 3cf7591206eb6ee02c3c3ab846f9e2e49d377dde Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 8 Oct 2024 17:03:27 +0200 Subject: [PATCH 2/4] fix(closeAll): not use transaction --- modules/ticket/back/methods/ticket/closeAll.js | 2 +- modules/ticket/back/methods/ticket/closure.js | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/modules/ticket/back/methods/ticket/closeAll.js b/modules/ticket/back/methods/ticket/closeAll.js index 143c0a3f0..8869f9464 100644 --- a/modules/ticket/back/methods/ticket/closeAll.js +++ b/modules/ticket/back/methods/ticket/closeAll.js @@ -54,7 +54,7 @@ module.exports = Self => { JOIN country co ON co.id = p.countryFk LEFT JOIN account.emailUser eu ON eu.userFk = c.salesPersonFk WHERE (al.code = 'PACKED' OR (am.code = 'refund' AND al.code <> 'delivered')) - AND DATE(t.shipped) BETWEEN ? - INTERVAL 2 DAY AND util.dayEnd(?) + AND DATE(t.shipped) BETWEEN ? - INTERVAL 7 DAY AND util.dayEnd(?) AND t.refFk IS NULL GROUP BY t.id `, [toDate, toDate]); diff --git a/modules/ticket/back/methods/ticket/closure.js b/modules/ticket/back/methods/ticket/closure.js index a75596bac..892c1ddc6 100644 --- a/modules/ticket/back/methods/ticket/closure.js +++ b/modules/ticket/back/methods/ticket/closure.js @@ -12,16 +12,18 @@ module.exports = async function(ctx, Self, tickets, options) { Object.assign(myOptions, options); let tx; - if (!myOptions.transaction) { - tx = await Self.beginTransaction({}); - myOptions.transaction = tx; - } + // if (!myOptions.transaction) { + // tx = await Self.beginTransaction({}); + // myOptions.transaction = tx; + // } if (tickets.length == 0) return; const failedtickets = []; for (const ticket of tickets) { try { + await Self.rawSql(`CALL util.debugAdd('invoicingTicket', ?)`, [ticket.id], {userId}); + await Self.app.models.InvoiceOut.getSerial(ticket.clientFk, ticket.companyFk, ticket.addressFk, 'quick'); await Self.rawSql( `CALL vn.ticket_closeByTicket(?)`, @@ -149,6 +151,10 @@ module.exports = async function(ctx, Self, tickets, options) { myOptions); } } catch (error) { + await Self.rawSql(` + INSERT INTO util.debug (variable, value) + VALUES ('invoicingTicketError', ?) + `, [ticket.id + ' - ' + error]); if (error.responseCode == 450) { await invalidEmail(ticket); continue; From 040304d04f5e587b77b1235733d3d914e3ee589b Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 8 Oct 2024 17:10:19 +0200 Subject: [PATCH 3/4] fix: merge --- modules/ticket/back/methods/ticket/closure.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/modules/ticket/back/methods/ticket/closure.js b/modules/ticket/back/methods/ticket/closure.js index 4797d47da..d20c83304 100644 --- a/modules/ticket/back/methods/ticket/closure.js +++ b/modules/ticket/back/methods/ticket/closure.js @@ -155,10 +155,7 @@ module.exports = async function(ctx, Self, tickets, options) { INSERT INTO util.debug (variable, value) VALUES ('invoicingTicketError', ?) `, [ticket.id + ' - ' + error]); -<<<<<<< HEAD -======= ->>>>>>> 087818e39d86256ae1e166112b0f648a7a0ff239 if (error.responseCode == 450) { await invalidEmail(ticket); continue; From 5eda0af20f84f609fe9d992ca45d788c605822fe Mon Sep 17 00:00:00 2001 From: Pako Date: Wed, 9 Oct 2024 07:24:34 +0200 Subject: [PATCH 4/4] feat: refs #8075 itemShelvingMoving --- db/routines/vn/triggers/itemShelving_beforeUpdate.sql | 3 +++ db/versions/11294-azureFern/00-firstScript.sql | 3 +++ 2 files changed, 6 insertions(+) create mode 100644 db/versions/11294-azureFern/00-firstScript.sql diff --git a/db/routines/vn/triggers/itemShelving_beforeUpdate.sql b/db/routines/vn/triggers/itemShelving_beforeUpdate.sql index fabdf8efb..53f85de01 100644 --- a/db/routines/vn/triggers/itemShelving_beforeUpdate.sql +++ b/db/routines/vn/triggers/itemShelving_beforeUpdate.sql @@ -9,5 +9,8 @@ BEGIN SET NEW.userFk = account.myUser_getId(); END IF; + IF NEW.shelvingFk <> OLD.shelvingFk THEN + SET NEW.movingState = NULL; + END IF; END$$ DELIMITER ; diff --git a/db/versions/11294-azureFern/00-firstScript.sql b/db/versions/11294-azureFern/00-firstScript.sql new file mode 100644 index 000000000..2d6ed3a5b --- /dev/null +++ b/db/versions/11294-azureFern/00-firstScript.sql @@ -0,0 +1,3 @@ +-- Place your SQL code here +ALTER TABLE vn.itemShelving DROP COLUMN IF EXISTS isMoving; +ALTER TABLE vn.itemShelving ADD IF NOT EXISTS movingState ENUM('selected','printed') NULL; \ No newline at end of file