refs #5837 fix filter existingClient France #1668

Merged
alexm merged 6 commits from 5837-quitRestrictionFrance into dev 2023-07-20 06:49:48 +00:00
4 changed files with 13 additions and 2 deletions
Showing only changes of commit 765c22df96 - Show all commits

View File

@ -22,6 +22,9 @@
},
"isUeeMember": {
"type": "boolean"
},
"isSocialNameUnique": {
"type": "boolean"
}
},
"relations": {
@ -39,4 +42,4 @@
"permission": "ALLOW"
}
]
}
}

View File

@ -0,0 +1,2 @@
ALTER TABLE `vn`.`country`
ADD COLUMN `isSocialNameUnique` tinyint(1) NOT NULL DEFAULT 1;

View File

@ -54,7 +54,8 @@ module.exports = Self => {
const existingClient = await Self.app.models.Client.findOne(filter);
if (existingClient) {
if (this.countryFk !== 19 && this.socialName === existingClient.socialName)
console.log(this.isSocialNameUnique);
Outdated
Review

No hi ha que posar ids per el codi. traulo finde un findOne de la taula per el code

No hi ha que posar ids per el codi. traulo finde un findOne de la taula per el code
if (!this.isSocialNameUnique && this.socialName === existingClient.socialName)
err();
}

View File

@ -181,6 +181,11 @@
"model": "Country",
"foreignKey": "countryFk"
},
"isSocialNameUnique": {
"type": "belongsTo",
"model": "Country",
"foreignKey": "countryFk"
},
"contactChannel": {
"type": "belongsTo",
"model": "ContactChannel",