update condition
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
ed84aa46bd
commit
e1c9195495
|
@ -183,18 +183,15 @@ module.exports = Self => {
|
||||||
Self.observe('before save', async ctx => {
|
Self.observe('before save', async ctx => {
|
||||||
const changes = ctx.data || ctx.instance;
|
const changes = ctx.data || ctx.instance;
|
||||||
const orgData = ctx.currentInstance;
|
const orgData = ctx.currentInstance;
|
||||||
const hasChanges = orgData && changes;
|
|
||||||
|
|
||||||
const businessTypeFk = changes && changes.businessTypeFk || orgData && orgData.businessTypeFk;
|
const businessTypeFk = changes && changes.businessTypeFk || orgData && orgData.businessTypeFk;
|
||||||
|
|
||||||
const isTaxDataChecked = changes && changes.isTaxDataChecked || orgData && orgData.isTaxDataChecked;
|
const isTaxDataChecked = changes && changes.isTaxDataChecked || orgData && orgData.isTaxDataChecked;
|
||||||
const isTaxDataCheckedChanged = hasChanges && orgData.isTaxDataChecked != isTaxDataChecked;
|
|
||||||
|
|
||||||
let isWorker = false;
|
let isWorker = false;
|
||||||
if (!ctx.isNewInstance)
|
if (!ctx.isNewInstance)
|
||||||
isWorker = await Self.app.models.UserAccount.findById(orgData.id);
|
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`);
|
throw new UserError(`The type of business must be filled in basic data`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue