HOTFIX: Disable address without a province
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
35e3c8ce65
commit
878e989c02
|
@ -91,20 +91,22 @@ module.exports = function(Self) {
|
|||
}
|
||||
});
|
||||
const provinceId = args.provinceFk || address.provinceFk;
|
||||
const province = await models.Province.findById(provinceId, {
|
||||
include: {
|
||||
relation: 'country'
|
||||
}
|
||||
}, options);
|
||||
if (provinceId) {
|
||||
const province = await models.Province.findById(provinceId, {
|
||||
include: {
|
||||
relation: 'country'
|
||||
}
|
||||
}, options);
|
||||
|
||||
const isUeeMember = province.country().isUeeMember;
|
||||
const incotermsId = args.incotermsFk || address.incotermsFk;
|
||||
if (!isUeeMember && !incotermsId)
|
||||
throw new UserError(`Incoterms is required for a non UEE member`);
|
||||
const isUeeMember = province.country().isUeeMember;
|
||||
const incotermsId = args.incotermsFk || address.incotermsFk;
|
||||
if (!isUeeMember && !incotermsId)
|
||||
throw new UserError(`Incoterms is required for a non UEE member`);
|
||||
|
||||
const customsAgentId = args.customsAgentFk || address.customsAgentFk;
|
||||
if (!isUeeMember && !customsAgentId)
|
||||
throw new UserError(`Customs agent is required for a non UEE member`);
|
||||
const customsAgentId = args.customsAgentFk || address.customsAgentFk;
|
||||
if (!isUeeMember && !customsAgentId)
|
||||
throw new UserError(`Customs agent is required for a non UEE member`);
|
||||
}
|
||||
|
||||
delete args.ctx; // Remove unwanted properties
|
||||
const updatedAddress = await address.updateAttributes(ctx.args, options);
|
||||
|
|
Loading…
Reference in New Issue