refactor(ticket): add more text in error when change zone
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Alex Moreno 2022-01-07 08:28:57 +01:00
parent 36bac4725d
commit 860499db82
3 changed files with 15 additions and 6 deletions

View File

@ -96,7 +96,7 @@
"This postcode already exists": "Este código postal ya existe", "This postcode already exists": "Este código postal ya existe",
"Concept cannot be blank": "El concepto no puede quedar en blanco", "Concept cannot be blank": "El concepto no puede quedar en blanco",
"File doesn't exists": "El archivo no existe", "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 those paramteres there are most than of one shipping option, 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", "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", "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", "Weekday cannot be blank": "El día de la semana no puede quedar en blanco",

View File

@ -112,10 +112,17 @@ module.exports = Self => {
const isProductionBoss = await models.Account.hasRole(userId, 'productionBoss', myOptions); const isProductionBoss = await models.Account.hasRole(userId, 'productionBoss', myOptions);
if (!isProductionBoss) { 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) if (!zoneShipped || zoneShipped.zoneFk != args.zoneFk) {
throw new UserError(`You don't have privileges to change the zone`); throw new UserError(`You don't have privileges to change the zone
or for those paramteres there are most than of one shipping option, talk to agencies`);
}
} }
const originalTicket = await models.Ticket.findOne({ const originalTicket = await models.Ticket.findOne({

View File

@ -81,8 +81,10 @@ module.exports = Self => {
args.warehouseId, args.warehouseId,
myOptions); myOptions);
if (!zoneShipped || zoneShipped.zoneFk != args.zoneId) if (!zoneShipped || zoneShipped.zoneFk != args.zoneId) {
throw new UserError(`You don't have privileges to change the zone`); throw new UserError(`You don't have privileges to change the zone
or for those paramteres there are most than of one shipping option, talk to agencies`);
}
} }
const items = await models.Sale.find({ const items = await models.Sale.find({