#5834 - billingDataAutoFillBic #1821

Merged
jsegarra merged 12 commits from 5834-billingDataAutoFillBic into dev 2024-02-06 16:36:36 +00:00
3 changed files with 23 additions and 1 deletions

View File

@ -8,6 +8,26 @@ module.exports = Self => {
}); });
Self.validatesUniquenessOf('bic', { Self.validatesUniquenessOf('bic', {
message: 'This BIC already exist.' message: 'This BIC already exist'
}); });
Outdated
Review

Con esto en el back ya valdria

Con esto en el back ya valdria

Entiendo que deberian estar las 2 validaciones del campo bic

Entiendo que deberian estar las 2 validaciones del campo bic
Self.validatesPresenceOf('countryFk', {

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' });

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();
}
}; };

View File

@ -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",

View File

@ -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"
} }