feat newState refs #7642
gitea/salix/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Sergio De la torre 2024-07-15 12:30:09 +02:00
parent 573f5c8d28
commit 8dbdbdf23b
1 changed files with 2 additions and 2 deletions

View File

@ -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);