From 8dbdbdf23bea35d2837f9ebd5a9e06443f51fc57 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Mon, 15 Jul 2024 12:30:09 +0200 Subject: [PATCH] feat newState refs #7642 --- modules/ticket/back/methods/ticket/saveSign.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/ticket/back/methods/ticket/saveSign.js b/modules/ticket/back/methods/ticket/saveSign.js index a76395c77..ae06d84ba 100644 --- a/modules/ticket/back/methods/ticket/saveSign.js +++ b/modules/ticket/back/methods/ticket/saveSign.js @@ -140,7 +140,7 @@ module.exports = Self => { await models.TicketDms.create({ticketFk: ticket.id, dmsFk: dms[0].id}, myOptions); await ticket.updateAttribute('isSigned', true, myOptions); - const [{stateForTicket}] = await Self.rawSql(` + const [{stateCode}] = await Self.rawSql(` SELECT IF((SUM(CASE WHEN est.code = 'DELIVERED' THEN 1 ELSE 0 END) = COUNT(*)), 'DELIVERED','PARTIAL_DELIVERED') stateForTicket @@ -149,7 +149,7 @@ module.exports = Self => { WHERE e.ticketFk = ?; `, [ticketId], myOptions); - await Self.rawSql(`CALL vn.ticket_setState(?, ?)`, [ticketId, stateForTicket], myOptions); + await Self.rawSql(`CALL vn.ticket_setState(?, ?)`, [ticketId, stateCode], myOptions); if (ticket?.address()?.province()?.country()?.code != 'ES' && ticket.cmrFk) { await models.Ticket.saveCmr(ctx, [ticketId], myOptions);