diff --git a/loopback/locale/es.json b/loopback/locale/es.json index cff5f652e..37cb8f7d9 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -96,7 +96,7 @@ "This postcode already exists": "Este código postal ya existe", "Concept cannot be blank": "El concepto no puede quedar en blanco", "File doesn't exists": "El archivo no existe", - "You don't have privileges to change the zone": "No tienes permisos para cambiar la zona", + "You don't have privileges to change the zone or for these parameters there are more than one shipping options, talk to agencies": "No tienes permisos para cambiar la zona o para esos parámetros hay más de una opción de envío, hable con las agencias", "This ticket is already on weekly tickets": "Este ticket ya está en tickets programados", "Ticket id cannot be blank": "El id de ticket no puede quedar en blanco", "Weekday cannot be blank": "El día de la semana no puede quedar en blanco", diff --git a/modules/ticket/back/methods/ticket/componentUpdate.js b/modules/ticket/back/methods/ticket/componentUpdate.js index 515689649..53e5fedc8 100644 --- a/modules/ticket/back/methods/ticket/componentUpdate.js +++ b/modules/ticket/back/methods/ticket/componentUpdate.js @@ -112,10 +112,19 @@ module.exports = Self => { const isProductionBoss = await models.Account.hasRole(userId, 'productionBoss', myOptions); if (!isProductionBoss) { - const zoneShipped = await models.Agency.getShipped(args.landed, args.addressFk, args.agencyModeFk, args.warehouseFk, myOptions); + const zoneShipped = await models.Agency.getShipped( + args.landed, + args.addressFk, + args.agencyModeFk, + args.warehouseFk, + myOptions); - if (!zoneShipped || zoneShipped.zoneFk != args.zoneFk) - throw new UserError(`You don't have privileges to change the zone`); + if (!zoneShipped || zoneShipped.zoneFk != args.zoneFk) { + const error = `You don't have privileges to change the zone or + for these parameters there are more than one shipping options, talk to agencies`; + + throw new UserError(error); + } } const originalTicket = await models.Ticket.findOne({ diff --git a/modules/ticket/back/methods/ticket/priceDifference.js b/modules/ticket/back/methods/ticket/priceDifference.js index 2456d3de0..1856cb08f 100644 --- a/modules/ticket/back/methods/ticket/priceDifference.js +++ b/modules/ticket/back/methods/ticket/priceDifference.js @@ -81,8 +81,12 @@ module.exports = Self => { args.warehouseId, myOptions); - if (!zoneShipped || zoneShipped.zoneFk != args.zoneId) - throw new UserError(`You don't have privileges to change the zone`); + if (!zoneShipped || zoneShipped.zoneFk != args.zoneId) { + const error = `You don't have privileges to change the zone or + for these parameters there are more than one shipping options, talk to agencies`; + + throw new UserError(error); + } } const items = await models.Sale.find({