fix: extracting logic gates to constants
This commit is contained in:
parent
8f2e29787b
commit
709a300388
|
@ -138,7 +138,8 @@ module.exports = Self => {
|
||||||
|
|
||||||
function hasIban(err, done) {
|
function hasIban(err, done) {
|
||||||
Self.app.models.PayMethod.findById(this.payMethodFk, (_, instance) => {
|
Self.app.models.PayMethod.findById(this.payMethodFk, (_, instance) => {
|
||||||
if (instance && instance.isIbanRequiredForClients && !this.iban)
|
const isMissingIban = instance && instance.isIbanRequiredForClients && !this.iban;
|
||||||
|
if (isMissingIban)
|
||||||
err();
|
err();
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
|
@ -79,8 +79,9 @@ module.exports = Self => {
|
||||||
const payMethod = await Self.app.models.PayMethod.findById(this.payMethodFk);
|
const payMethod = await Self.app.models.PayMethod.findById(this.payMethodFk);
|
||||||
const supplierAccount = await Self.app.models.SupplierAccount.findOne({where: {supplierFk: this.id}});
|
const supplierAccount = await Self.app.models.SupplierAccount.findOne({where: {supplierFk: this.id}});
|
||||||
const hasIban = supplierAccount && supplierAccount.iban;
|
const hasIban = supplierAccount && supplierAccount.iban;
|
||||||
|
const isMissingIban = payMethod && payMethod.isIbanRequiredForSuppliers && !hasIban;
|
||||||
|
|
||||||
if (payMethod && payMethod.isIbanRequiredForSuppliers && !hasIban)
|
if (isMissingIban)
|
||||||
err();
|
err();
|
||||||
|
|
||||||
done();
|
done();
|
||||||
|
|
Loading…
Reference in New Issue