Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into dev
This commit is contained in:
commit
4b76eadd07
|
@ -73,6 +73,7 @@ module.exports = Self => {
|
||||||
Self.validateAsync('fi', tinIsValid, {
|
Self.validateAsync('fi', tinIsValid, {
|
||||||
message: 'Invalid TIN'
|
message: 'Invalid TIN'
|
||||||
});
|
});
|
||||||
|
|
||||||
let validateTin = require('../validations/validateTin');
|
let validateTin = require('../validations/validateTin');
|
||||||
async function tinIsValid(err, done) {
|
async function tinIsValid(err, done) {
|
||||||
if (!this.isTaxDataChecked)
|
if (!this.isTaxDataChecked)
|
||||||
|
@ -85,7 +86,7 @@ module.exports = Self => {
|
||||||
let country = await Self.app.models.Country.findOne(filter);
|
let country = await Self.app.models.Country.findOne(filter);
|
||||||
let code = country ? country.code.toLowerCase() : null;
|
let code = country ? country.code.toLowerCase() : null;
|
||||||
|
|
||||||
if (!validateTin(this.fi, code))
|
if (!this.fi || !validateTin(this.fi, code))
|
||||||
err();
|
err();
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue