Merge branch 'dev' of http://git.verdnatura.es/salix into dev

This commit is contained in:
Carlos Jimenez 2018-11-23 09:32:23 +01:00
commit ea97454fd2
6 changed files with 27 additions and 14 deletions

View File

@ -43,7 +43,8 @@
search-function="{or: [{bic: {regexp: $search}}, {name: {regexp: $search}}]}"
value-field="id"
show-field="bic"
vn-acl="salesAssistant">
vn-acl="salesAssistant"
disabled="$ctrl.ibanCountry == 'ES'">
<tpl-item>
<vn-horizontal>
<vn-one>{{bic}}</vn-one>

View File

@ -76,14 +76,21 @@ export default class Controller {
return true;
}
get ibanCountry() {
if (!this.client || !this.client.iban) return false;
let countryCode = this.client.iban.substr(0, 2);
return countryCode;
}
autofillBic() {
if (!this.client.iban) return;
let countryCode = this.client.iban.substr(0, 2);
let bankEntityId = parseInt(this.client.iban.substr(4, 4));
let filter = {where: {id: bankEntityId}};
if (countryCode != 'ES') return;
if (this.ibanCountry != 'ES') return;
let json = encodeURIComponent(JSON.stringify(filter));
this.$http.get(`/client/api/BankEntities?filter=${json}`).then(response => {

View File

@ -136,5 +136,14 @@ describe('Client', () => {
expect(controller.client.bankEntityFk).toEqual(128);
});
});
describe('ibanCountry()', () => {
it('should return a country code from iban', () => {
controller.client.iban = 'ES123';
let countryCode = controller.ibanCountry;
expect(countryCode).toEqual('ES');
});
});
});
});

View File

@ -26,15 +26,17 @@
<vn-icon-button
icon="check"
vn-acl="administrative"
vn-acl-action="remove"
vn-tooltip="Confirm transaction"
ng-show="::!transaction.isConfirmed"
ng-click="$ctrl.confirm(transaction)">
</vn-icon-button>
</vn-td>
<vn-td>{{::transaction.id}}</vn-td>
<vn-td number>{{::transaction.amount | currency: ' €':2}}</vn-td>
<vn-td>{{::transaction.created | date:'dd/MM/yyyy'}}</vn-td>
<vn-td>
<vn-td number>{{::transaction.amount | currency: '€':2}}</vn-td>
<vn-td>{{::transaction.created | dateTime:'dd/MM/yyyy'}}</vn-td>
<vn-td style="width: 1px">
<vn-icon orange
vn-tooltip="{{$ctrl.getFormattedMessage(transaction)}}"
ng-show="::(transaction.errorMessage || transaction.responseMessage)"

View File

@ -19,12 +19,6 @@ describe('Order', () => {
}));
describe('set order', () => {
it(`should not set order if the value given is null`, () => {
controller.order = null;
expect(controller.order).toEqual({});
});
it(`should set order if the value given is not null`, () => {
controller.order = 1;
@ -88,7 +82,7 @@ describe('Order', () => {
$httpBackend.flush();
expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!');
expect(controller.$state.go).toHaveBeenCalledWith("order.card.catalog", {id: 1});
expect(controller.$state.go).toHaveBeenCalledWith('order.card.catalog', {id: 1});
});
});
});

View File

@ -54,7 +54,7 @@ module.exports = Self => {
};
let country = await Self.app.models.Country.findOne(filter);
let code = country ? country.code.toLowerCase() : null;
if (code === 'fr')
if (code != 'es')
return done();
if (!validateIban(this.iban))