From 0e3d568743828a0ea01ff6c06504b9fe13fe0d1e Mon Sep 17 00:00:00 2001 From: Gerard Date: Wed, 6 Mar 2019 14:06:36 +0100 Subject: [PATCH] #1218 ticket.new quitar restricciones al crear un ticket abono --- modules/ticket/back/methods/ticket/new.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/ticket/back/methods/ticket/new.js b/modules/ticket/back/methods/ticket/new.js index a1a53ca3b..db25fe715 100644 --- a/modules/ticket/back/methods/ticket/new.js +++ b/modules/ticket/back/methods/ticket/new.js @@ -36,10 +36,14 @@ module.exports = Self => { ] }); - {if (!address) - throw new UserError(`This address doesn't exist`);} + if (!address) + throw new UserError(`This address doesn't exist`); - if (address.client().type().code === 'normal') { + let agency; + if (params && params.agencyModeFk) + agency = await Self.app.models.AgencyMode.findById(params.agencyModeFk); + + if (address.client().type().code === 'normal' && (!agency || agency.code != 'refund')) { if (address.client().isFreezed) throw new UserError(`You can't create a ticket for a frozen client`); @@ -54,10 +58,6 @@ module.exports = Self => { throw new UserError(`You can't create a ticket for a client that has a debt`); } - let agency; - if (params.agencyModeFk) - agency = await Self.app.models.AgencyMode.findById(params.agencyModeFk); - if (!params.shipped && params.landed) { params.shipped = await Self.app.models.Agency.getShipped({ landed: params.landed,