From e1c91954955ae8414be792f2f95341ad039b92d0 Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 5 Jan 2022 14:53:29 +0100 Subject: [PATCH] update condition --- modules/client/back/models/client.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/modules/client/back/models/client.js b/modules/client/back/models/client.js index ea87a49ee..06453da36 100644 --- a/modules/client/back/models/client.js +++ b/modules/client/back/models/client.js @@ -183,18 +183,15 @@ module.exports = Self => { Self.observe('before save', async ctx => { const changes = ctx.data || ctx.instance; const orgData = ctx.currentInstance; - const hasChanges = orgData && changes; const businessTypeFk = changes && changes.businessTypeFk || orgData && orgData.businessTypeFk; - const isTaxDataChecked = changes && changes.isTaxDataChecked || orgData && orgData.isTaxDataChecked; - const isTaxDataCheckedChanged = hasChanges && orgData.isTaxDataChecked != isTaxDataChecked; let isWorker = false; if (!ctx.isNewInstance) isWorker = await Self.app.models.UserAccount.findById(orgData.id); - if (!businessTypeFk && !isTaxDataChecked && !isTaxDataCheckedChanged && !isWorker) + if (!businessTypeFk && !isTaxDataChecked && !isWorker) throw new UserError(`The type of business must be filled in basic data`); });