refs #5540 validacion nif
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Carlos Satorres 2023-04-12 14:39:40 +02:00
parent 117849f093
commit 60103fa80a
2 changed files with 7 additions and 9 deletions

View File

@ -274,5 +274,6 @@
"This ticket cannot be signed because it has not been boxed": "Este ticket no puede firmarse porque no ha sido encajado",
"Insert a date range": "Inserte un rango de fechas",
"Added observation": "{{user}} añadió esta observacion: {{text}}",
"Comment added to client": "Observación añadida al cliente {{clientFk}}"
"Comment added to client": "Observación añadida al cliente {{clientFk}}",
"The first two values are letters": "Los dos primeros carácteres del NIF son letras"
}

View File

@ -73,16 +73,13 @@ module.exports = Self => {
done();
}
Self.validateAsync('nif', areFirstTwoCharsLetters, nifInvalid, {
message: 'The first two values are letters.'});
Self.validateAsync('nif', nifInvalid, {
message: 'The first two values are letters'});
function areFirstTwoCharsLetters(str) {
return /^[a-zA-Z]{2}/.test(str);
}
async function nifInvalid(err, areFirstTwoCharsLetters) {
if (this.isVies == 1 && areFirstTwoCharsLetters(this.nif))
async function nifInvalid(err, done) {
if (this.isVies && /^[a-zA-Z]{2}/.test(this.nif))
err();
done();
}
function isAlpha(value) {