3247-refactor(ticket): add more text in the error when change zone #841

Merged
carlosjr merged 2 commits from 3247-ticket_basic-data into dev 2022-01-10 10:41:27 +00:00
3 changed files with 19 additions and 6 deletions

View File

@ -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",

View File

@ -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({

View File

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

there are some typos on the error message, here's the correction:

'You don't have privileges to change the zone or for these parameters there are more than one shipping options, talk to agencies'

Also try extracting long arguments to constants.

there are some typos on the error message, here's the correction: 'You don't have privileges to change the zone or for these parameters there are more than one shipping options, talk to agencies' Also try extracting long arguments to constants.
for these parameters there are more than one shipping options, talk to agencies`;
throw new UserError(error);
}
}
const items = await models.Sale.find({