Merge branch 'test' into dev
gitea/salix/dev This commit looks good Details

This commit is contained in:
Gerard 2019-03-06 14:13:58 +01:00
commit 1cc196983e
1 changed files with 7 additions and 7 deletions

View File

@ -36,10 +36,14 @@ module.exports = Self => {
]
});
{if (!address)
throw new UserError(`This address doesn't exist`);}
if (!address)
throw new UserError(`This address doesn't exist`);
if (address.client().type().code === 'normal') {
let agency;
if (params && params.agencyModeFk)
agency = await Self.app.models.AgencyMode.findById(params.agencyModeFk);
if (address.client().type().code === 'normal' && (!agency || agency.code != 'refund')) {
if (address.client().isFreezed)
throw new UserError(`You can't create a ticket for a frozen client`);
@ -54,10 +58,6 @@ module.exports = Self => {
throw new UserError(`You can't create a ticket for a client that has a debt`);
}
let agency;
if (params.agencyModeFk)
agency = await Self.app.models.AgencyMode.findById(params.agencyModeFk);
if (!params.shipped && params.landed) {
params.shipped = await Self.app.models.Agency.getShipped({
landed: params.landed,