refs #6915 test_master24_8 #2067

Merged
alexm merged 561 commits from test_master24_8 into master 2024-02-22 07:31:34 +00:00
7 changed files with 27 additions and 9 deletions
Showing only changes of commit 2cdebcd69f - Show all commits

View File

@ -10,4 +10,20 @@ module.exports = Self => {
Self.validatesUniquenessOf('bic', { Self.validatesUniquenessOf('bic', {
message: 'This BIC already exist.' message: 'This BIC already exist.'
}); });
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

@ -41,7 +41,8 @@
vn-one vn-one
ng-show="country.selection.code === 'ES'" ng-show="country.selection.code === 'ES'"
label="Entity code" label="Entity code"
ng-model="$ctrl.data.id"> ng-model="$ctrl.data.id"
required="true">
</vn-textfield> </vn-textfield>
</vn-horizontal> </vn-horizontal>
</tpl-body> </tpl-body>

View File

@ -10,7 +10,7 @@ class Controller extends Dialog {
if (!this.data.countryFk) if (!this.data.countryFk)
throw new Error(`The country can't be empty`); throw new Error(`The country can't be empty`);
return this.$http.post(`bankEntities`, this.data) return this.$http.post(`BankEntities`, this.data)
.then(res => this.data.id = res.data.id) .then(res => this.data.id = res.data.id)
.then(() => super.responseHandler(response)) .then(() => super.responseHandler(response))
.then(() => this.vnApp.showSuccess(this.$t('Data saved!'))); .then(() => this.vnApp.showSuccess(this.$t('Data saved!')));

View File

@ -196,6 +196,7 @@
"Negative basis of tickets: 23": "Negative basis of tickets: 23", "Negative basis of tickets: 23": "Negative basis of tickets: 23",
"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"
} }

View File

@ -325,5 +325,7 @@
"Booking completed": "Reserva completada", "Booking completed": "Reserva completada",
"The ticket is in preparation": "El ticket [{{ticketId}}]({{{ticketUrl}}}) del comercial {{salesPersonId}} está en preparación", "The ticket is in preparation": "El ticket [{{ticketId}}]({{{ticketUrl}}}) del comercial {{salesPersonId}} está en preparación",
"The amount cannot be less than the minimum": "La cantidad no puede ser menor que la cantidad mímina", "The amount cannot be less than the minimum": "La cantidad no puede ser menor que la cantidad mímina",
"quantityLessThanMin": "La cantidad no puede ser menor que la cantidad mímina" "quantityLessThanMin": "La cantidad no puede ser menor que la cantidad mímina",
"Bank entity must be specified": "La entidad bancaria es obligatoria"
} }

View File

@ -51,15 +51,12 @@ export default class Controller extends Section {
autofillBic() { autofillBic() {
if (!this.client || !this.client.iban) return; if (!this.client || !this.client.iban) return;
let bankEntityId = parseInt(this.client.iban.substr(4, 4)); let bankEntityId = parseInt(this.client.iban.substr(4, 4));
let filter = {where: {id: bankEntityId}}; let filter = {where: {id: bankEntityId}};
if (this.ibanCountry != 'ES') return; if (this.ibanCountry != 'ES') return;
this.$http.get(`BankEntities`, {filter}).then(response => { this.$http.get(`BankEntities`, {filter}).then(response => {
const hasData = response.data && response.data[0]; const hasData = response.data && response.data[0];
if (hasData) if (hasData)
this.client.bankEntityFk = response.data[0].id; this.client.bankEntityFk = response.data[0].id;
else if (!hasData) else if (!hasData)

View File

@ -30,7 +30,8 @@ export default class Controller extends Section {
} }
autofillBic() { autofillBic() {
if (!this.worker || !this.worker.iban) return; AutoFillBicComponent.controller.prototype.autofillBic(this.client);
/* if (!this.worker || !this.worker.iban) return;
let bankEntityId = parseInt(this.worker.iban.substr(4, 4)); let bankEntityId = parseInt(this.worker.iban.substr(4, 4));
let filter = {where: {id: bankEntityId}}; let filter = {where: {id: bankEntityId}};
@ -42,7 +43,7 @@ export default class Controller extends Section {
this.worker.bankEntityFk = response.data[0].id; this.worker.bankEntityFk = response.data[0].id;
else if (!hasData) else if (!hasData)
this.worker.bankEntityFk = null; this.worker.bankEntityFk = null;
}); }); */
} }
generateCodeUser() { generateCodeUser() {