#5834 - billingDataAutoFillBic #1821
|
@ -8,6 +8,26 @@ module.exports = Self => {
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.validatesUniquenessOf('bic', {
|
Self.validatesUniquenessOf('bic', {
|
||||||
message: 'This BIC already exist.'
|
message: 'This BIC already exist'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
|
Self.validatesPresenceOf('countryFk', {
|
||||||
jsegarra
commented
He hecho pruebas y he visto que si envias countryFk a null da error y este no es informativo al usuario. Propuesta, añadir en bank-entity.js esta validación He hecho pruebas y he visto que si envias countryFk a null da error y este no es informativo al usuario.
Propuesta, añadir en bank-entity.js esta validación
` Self.validatesPresenceOf('countryFk', {
message: 'CountryFK cannot be empty'
});`
|
|||||||
|
message: 'CountryFK cannot be empty'
|
||||||
|
});
|
||||||
|
|
||||||
|
Self.validateAsync('bic', checkBic, {
|
||||||
|
message: 'Bank entity id must be specified'
|
||||||
|
});
|
||||||
|
async function checkBic(err, done) {
|
||||||
|
const filter = {
|
||||||
|
fields: ['code'],
|
||||||
|
where: {id: this.countryFk}
|
||||||
|
};
|
||||||
|
const country = await Self.app.models.Country.findOne(filter);
|
||||||
|
const code = country ? country.code.toLowerCase() : null;
|
||||||
|
|
||||||
|
if (code == 'es' && !this.id)
|
||||||
|
err();
|
||||||
|
done();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -198,6 +198,7 @@
|
||||||
"Booking completed": "Booking complete",
|
"Booking completed": "Booking complete",
|
||||||
"The ticket is in preparation": "The ticket [{{ticketId}}]({{{ticketUrl}}}) of the sales person {{salesPersonId}} is in preparation",
|
"The ticket is in preparation": "The ticket [{{ticketId}}]({{{ticketUrl}}}) of the sales person {{salesPersonId}} is in preparation",
|
||||||
"You can only add negative amounts in refund tickets": "You can only add negative amounts in refund tickets",
|
"You can only add negative amounts in refund tickets": "You can only add negative amounts in refund tickets",
|
||||||
|
"Bank entity must be specified": "Bank entity must be specified",
|
||||||
"Try again": "Try again",
|
"Try again": "Try again",
|
||||||
"keepPrice": "keepPrice",
|
"keepPrice": "keepPrice",
|
||||||
"Cannot past travels with entries": "Cannot past travels with entries",
|
"Cannot past travels with entries": "Cannot past travels with entries",
|
||||||
|
|
|
@ -338,5 +338,6 @@
|
||||||
"The alias cant be modified": "Este alias de correo no puede ser modificado",
|
"The alias cant be modified": "Este alias de correo no puede ser modificado",
|
||||||
"No tickets to invoice": "No hay tickets para facturar",
|
"No tickets to invoice": "No hay tickets para facturar",
|
||||||
"Name should be uppercase": "El nombre debe ir en mayúscula",
|
"Name should be uppercase": "El nombre debe ir en mayúscula",
|
||||||
|
"Bank entity must be specified": "La entidad bancaria es obligatoria",
|
||||||
"An email is necessary": "Es necesario un email"
|
"An email is necessary": "Es necesario un email"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Con esto en el back ya valdria
Entiendo que deberian estar las 2 validaciones del campo bic