From eaf425fb518c525ef27b798cecb1fe598981dffb Mon Sep 17 00:00:00 2001 From: carlossa Date: Wed, 3 May 2023 12:30:33 +0200 Subject: [PATCH 1/6] refs #5328 mod funcion createTicketRefund --- modules/ticket/back/methods/sale/refund.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/ticket/back/methods/sale/refund.js b/modules/ticket/back/methods/sale/refund.js index af58a6286..2517fbd99 100644 --- a/modules/ticket/back/methods/sale/refund.js +++ b/modules/ticket/back/methods/sale/refund.js @@ -11,7 +11,7 @@ module.exports = Self => { { arg: 'servicesIds', type: ['number'] - } + }, ], returns: { type: ['number'], @@ -110,11 +110,13 @@ module.exports = Self => { } }; - async function createTicketRefund(ticketId, now, refundAgencyMode, refoundZoneId, myOptions) { + async function createTicketRefund(ticketId, now, refundAgencyMode, refoundZoneId, myOptions, vTicketId) { const models = Self.app.models; const filter = {include: {relation: 'address'}}; const ticket = await models.Ticket.findById(ticketId, filter, myOptions); + const query = `CALL vn.ticket_recalc(?)`; + const [result] = await Self.rawSql(query, [vTicketId]); const refundTicket = await models.Ticket.create({ clientFk: ticket.clientFk, @@ -131,7 +133,7 @@ module.exports = Self => { await models.TicketRefund.create({ refundTicketFk: refundTicket.id, originalTicketFk: ticket.id, - }, myOptions); + }, myOptions, [result]); return refundTicket; } -- 2.40.1 From 3b2e1ca8d5db0e73369f62fd29fe0f08618b5557 Mon Sep 17 00:00:00 2001 From: carlossa Date: Wed, 3 May 2023 12:36:30 +0200 Subject: [PATCH 2/6] ref #5328 refundTicket.id --- modules/ticket/back/methods/sale/refund.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/ticket/back/methods/sale/refund.js b/modules/ticket/back/methods/sale/refund.js index 2517fbd99..d58875019 100644 --- a/modules/ticket/back/methods/sale/refund.js +++ b/modules/ticket/back/methods/sale/refund.js @@ -101,6 +101,8 @@ module.exports = Self => { } } + const query = `CALL vn.ticket_recalc(?)`; + const [result] = await Self.rawSql(query, [refundTicket.id]); if (tx) await tx.commit(); return refundTicket; @@ -115,8 +117,6 @@ module.exports = Self => { const filter = {include: {relation: 'address'}}; const ticket = await models.Ticket.findById(ticketId, filter, myOptions); - const query = `CALL vn.ticket_recalc(?)`; - const [result] = await Self.rawSql(query, [vTicketId]); const refundTicket = await models.Ticket.create({ clientFk: ticket.clientFk, -- 2.40.1 From 566f03c4976deb68e499e11258983b3e2de880ce Mon Sep 17 00:00:00 2001 From: carlossa Date: Wed, 3 May 2023 13:03:14 +0200 Subject: [PATCH 3/6] refs #5328 commit prueba --- modules/ticket/back/methods/sale/refund.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/ticket/back/methods/sale/refund.js b/modules/ticket/back/methods/sale/refund.js index d58875019..9ee7735a0 100644 --- a/modules/ticket/back/methods/sale/refund.js +++ b/modules/ticket/back/methods/sale/refund.js @@ -112,7 +112,7 @@ module.exports = Self => { } }; - async function createTicketRefund(ticketId, now, refundAgencyMode, refoundZoneId, myOptions, vTicketId) { + async function createTicketRefund(ticketId, now, refundAgencyMode, refoundZoneId, myOptions) { const models = Self.app.models; const filter = {include: {relation: 'address'}}; @@ -133,7 +133,7 @@ module.exports = Self => { await models.TicketRefund.create({ refundTicketFk: refundTicket.id, originalTicketFk: ticket.id, - }, myOptions, [result]); + }, myOptions); return refundTicket; } -- 2.40.1 From 3ac1ce403c8873013f5c77e426cedbc2e6f5b32b Mon Sep 17 00:00:00 2001 From: carlossa Date: Wed, 3 May 2023 14:06:57 +0200 Subject: [PATCH 4/6] refs #5328 myOptions --- modules/ticket/back/methods/sale/refund.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/modules/ticket/back/methods/sale/refund.js b/modules/ticket/back/methods/sale/refund.js index 9ee7735a0..ffbc73db0 100644 --- a/modules/ticket/back/methods/sale/refund.js +++ b/modules/ticket/back/methods/sale/refund.js @@ -100,9 +100,7 @@ module.exports = Self => { }, myOptions); } } - - const query = `CALL vn.ticket_recalc(?)`; - const [result] = await Self.rawSql(query, [refundTicket.id]); + const query = `CALL vn.ticket_recalc(?)`; await Self.rawSql(query, [refundTicket.id], myOptions); if (tx) await tx.commit(); return refundTicket; -- 2.40.1 From dbd0e5138b1d396b36b35e01a53206b02e301b51 Mon Sep 17 00:00:00 2001 From: carlossa Date: Wed, 3 May 2023 14:12:26 +0200 Subject: [PATCH 5/6] refs #5328 fix --- modules/ticket/back/methods/sale/refund.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ticket/back/methods/sale/refund.js b/modules/ticket/back/methods/sale/refund.js index ffbc73db0..3a633de0f 100644 --- a/modules/ticket/back/methods/sale/refund.js +++ b/modules/ticket/back/methods/sale/refund.js @@ -11,7 +11,7 @@ module.exports = Self => { { arg: 'servicesIds', type: ['number'] - }, + } ], returns: { type: ['number'], -- 2.40.1 From ec5a5be9e67ebf99aa57d1e9362839cf0befd94a Mon Sep 17 00:00:00 2001 From: carlossa Date: Tue, 30 May 2023 09:18:52 +0200 Subject: [PATCH 6/6] refs #5328 remove spaces --- modules/ticket/back/methods/sale/refund.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/ticket/back/methods/sale/refund.js b/modules/ticket/back/methods/sale/refund.js index 3a633de0f..18ccee976 100644 --- a/modules/ticket/back/methods/sale/refund.js +++ b/modules/ticket/back/methods/sale/refund.js @@ -100,7 +100,10 @@ module.exports = Self => { }, myOptions); } } - const query = `CALL vn.ticket_recalc(?)`; await Self.rawSql(query, [refundTicket.id], myOptions); + + const query = `CALL vn.ticket_recalc(?)`; + await Self.rawSql(query, [refundTicket.id], myOptions); + if (tx) await tx.commit(); return refundTicket; -- 2.40.1