back errors fixed
gitea/salix/master This commit looks good Details

This commit is contained in:
Joan Sanchez 2019-08-01 11:52:53 +02:00
parent e3c4536183
commit e7511aefdc
4 changed files with 3 additions and 7 deletions

View File

@ -25,11 +25,9 @@ export default class Controller {
const town = selection.town;
const province = town.province;
const country = province.country;
this.address.city = town.name;
this.address.provinceFk = province.id;
this.address.countryFk = country.id;
}
onResponse(response) {

View File

@ -32,11 +32,9 @@ export default class Controller {
const town = selection.town;
const province = town.province;
const country = province.country;
this.address.city = town.name;
this.address.provinceFk = province.id;
this.address.countryFk = country.id;
}
onResponse(response) {

View File

@ -63,13 +63,13 @@ module.exports = Self => {
if (!params.shipped && params.landed) {
const shippedResult = await models.Agency.getShipped(params.landed,
address.id, params.agencyModeFk, params.warehouseFk);
params.shipped = shippedResult.shipped;
params.shipped = shippedResult && shippedResult.shipped;
}
if (params.shipped && !params.landed) {
const landedResult = await models.Agency.getLanded(params.shipped,
address.id, params.agencyModeFk, params.warehouseFk);
params.landed = landedResult.landed;
params.landed = landedResult && landedResult.landed;
}
if (!params.userId && ctx.req && ctx.req.accessToken.userId)

View File

@ -63,7 +63,7 @@ module.exports = Self => {
if (!isProductionBoss) {
const zone = await models.Agency.getShipped(landed, addressId, agencyModeId, warehouseId);
if (zone.id != zoneId)
if (!zone || zone.id != zoneId)
throw new UserError(`You don't have privileges to change the zone`);
}