From 578bcd3ccec9eca427c576fbb81e3c48ac8bd9c9 Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 25 Jan 2024 11:09:56 +0100 Subject: [PATCH] hotFix: saveSign --- modules/account/front/role/card/index.spec.js | 2 +- .../front/role/descriptor/index.spec.js | 2 +- .../ticket/back/methods/ticket/saveSign.js | 39 ++++++++++--------- 3 files changed, 22 insertions(+), 21 deletions(-) diff --git a/modules/account/front/role/card/index.spec.js b/modules/account/front/role/card/index.spec.js index f02c08f285..569fe487d2 100644 --- a/modules/account/front/role/card/index.spec.js +++ b/modules/account/front/role/card/index.spec.js @@ -1,6 +1,6 @@ import './index'; -fdescribe('component vnRoleCard', () => { +describe('component vnRoleCard', () => { let controller; let $httpBackend; diff --git a/modules/account/front/role/descriptor/index.spec.js b/modules/account/front/role/descriptor/index.spec.js index eafb96727e..f3b2e4763a 100644 --- a/modules/account/front/role/descriptor/index.spec.js +++ b/modules/account/front/role/descriptor/index.spec.js @@ -1,6 +1,6 @@ import './index'; -fdescribe('component vnRoleDescriptor', () => { +describe('component vnRoleDescriptor', () => { let controller; let $httpBackend; diff --git a/modules/ticket/back/methods/ticket/saveSign.js b/modules/ticket/back/methods/ticket/saveSign.js index e062e6f845..3f383feccd 100644 --- a/modules/ticket/back/methods/ticket/saveSign.js +++ b/modules/ticket/back/methods/ticket/saveSign.js @@ -72,24 +72,25 @@ module.exports = Self => { async function createGestDoc(id) { const ticket = await models.Ticket.findById(id, - {include: [ - { - relation: 'warehouse', - scope: { - fields: ['id'] + { + include: [ + { + relation: 'warehouse', + scope: { + fields: ['id'] + } + }, { + relation: 'client', + scope: { + fields: ['name'] + } + }, { + relation: 'route', + scope: { + fields: ['id'] + } } - }, { - relation: 'client', - scope: { - fields: ['name'] - } - }, { - relation: 'route', - scope: { - fields: ['id'] - } - } - ] + ] }, myOptions); const dmsType = await models.DmsType.findOne({where: {code: 'Ticket'}, fields: ['id']}, myOptions); const ctxUploadFile = Object.assign({}, ctx); @@ -125,7 +126,7 @@ module.exports = Self => { if (await gestDocExists(ticketId)) throw new UserError('Ticket is already signed'); - if (location) setLocation(ticketId); + if (location) await setLocation(ticketId); if (!gestDocCreated) await createGestDoc(ticketId); await models.TicketDms.create({ticketFk: ticketId, dmsFk: dms[0].id}, myOptions); const ticket = await models.Ticket.findById(ticketId, null, myOptions); @@ -135,7 +136,7 @@ module.exports = Self => { where: { code: 'DELIVERED' } - }, options); + }, myOptions); await models.Ticket.state(ctx, { ticketFk: ticketId,