diff --git a/modules/client/front/postcode/index.html b/modules/client/front/postcode/index.html index b3dbb74d8..fa0b7870f 100644 --- a/modules/client/front/postcode/index.html +++ b/modules/client/front/postcode/index.html @@ -53,7 +53,7 @@ diff --git a/modules/worker/back/methods/worker/new.js b/modules/worker/back/methods/worker/new.js index ba9dc3853..fddabcf43 100644 --- a/modules/worker/back/methods/worker/new.js +++ b/modules/worker/back/methods/worker/new.js @@ -202,7 +202,7 @@ module.exports = Self => { bossFk, fi, birth, - + provinceFk, }, myOptions); if (tx) await tx.commit(); diff --git a/modules/worker/back/models/worker.js b/modules/worker/back/models/worker.js index 0b0e043f2..3507cab8a 100644 --- a/modules/worker/back/models/worker.js +++ b/modules/worker/back/models/worker.js @@ -27,13 +27,17 @@ module.exports = Self => { }); async function tinIsValid(err, done) { + const countryFk = { + fields: ['countryFk'], + where: {id: this.provinceFk} + }; + const countryCode = await Self.app.models.Province.findOne(countryFk); const filter = { fields: ['code'], - where: {id: this.countryFk} + where: {id: countryCode.countryFk} }; const country = await Self.app.models.Country.findOne(filter); const code = country ? country.code.toLowerCase() : null; - if (!this.fi || !validateTin(this.fi, code)) err(); done();