From eaf425fb518c525ef27b798cecb1fe598981dffb Mon Sep 17 00:00:00 2001 From: carlossa Date: Wed, 3 May 2023 12:30:33 +0200 Subject: [PATCH] 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; }