From b156215b876bf21b6e9251ac13dd7bcc147f6039 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Thu, 31 Aug 2023 13:33:57 +0200 Subject: [PATCH] refs #6132 fix: saveSign ticket without route --- loopback/locale/en.json | 3 ++- loopback/locale/es.json | 5 +++-- modules/ticket/back/methods/ticket/saveSign.js | 3 +++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/loopback/locale/en.json b/loopback/locale/en.json index 46b48e2ea..e14ff67bb 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -185,5 +185,6 @@ "You don't have enough privileges.": "You don't have enough privileges.", "This ticket is locked.": "This ticket is locked.", "This ticket is not editable.": "This ticket is not editable.", - "The ticket doesn't exist.": "The ticket doesn't exist." + "The ticket doesn't exist.": "The ticket doesn't exist.", + "Ticket without route": "Ticket without route" } diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 195b683ad..c37571050 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -315,5 +315,6 @@ "This ticket is not editable.": "Este ticket no es editable.", "The ticket doesn't exist.": "No existe el ticket.", "Social name should be uppercase": "La razón social debe ir en mayúscula", - "Street should be uppercase": "La dirección fiscal debe ir en mayúscula" -} + "Street should be uppercase": "La dirección fiscal debe ir en mayúscula", + "Ticket without Route": "Ticket sin ruta" +} \ No newline at end of file diff --git a/modules/ticket/back/methods/ticket/saveSign.js b/modules/ticket/back/methods/ticket/saveSign.js index 55d2e3281..70f1e696c 100644 --- a/modules/ticket/back/methods/ticket/saveSign.js +++ b/modules/ticket/back/methods/ticket/saveSign.js @@ -93,6 +93,9 @@ module.exports = Self => { }, myOptions); const dmsType = await models.DmsType.findOne({where: {code: 'Ticket'}, fields: ['id']}, myOptions); const ctxUploadFile = Object.assign({}, ctx); + if (ticket.route() === null) + throw new UserError('Ticket without route'); + ctxUploadFile.args = { warehouseId: ticket.warehouseFk, companyId: ticket.companyFk,