añadido if para los clientes que no tienen dni

This commit is contained in:
Gerard 2018-11-29 11:08:26 +01:00
parent 7a368f3dd0
commit cfefc980f6
1 changed files with 7 additions and 2 deletions

View File

@ -17,8 +17,13 @@ module.exports = Self => {
async function cannotHaveET(err, done) { async function cannotHaveET(err, done) {
let client = await Self.app.models.Client.findById(this.clientFk); let client = await Self.app.models.Client.findById(this.clientFk);
let cannotHaveET;
if (client && client.fi) {
let tin = client.fi.toUpperCase(); let tin = client.fi.toUpperCase();
let cannotHaveET = /^[A-B]/.test(tin); cannotHaveET = /^[A-B]/.test(tin);
} else
cannotHaveET = false;
if (cannotHaveET && this.isEqualizated) if (cannotHaveET && this.isEqualizated)
err(); err();