fixed bug localBank being null

This commit is contained in:
Gerard 2019-01-25 12:24:07 +01:00
parent 6e6b646978
commit 567f5aaa78
2 changed files with 10 additions and 4 deletions

View File

@ -41,7 +41,9 @@
data="banksData"
select-fields="['id','bank']"
show-field="bank"
order="id"
value-field="id">
<tpl-item>{{id}}: {{bank}}</tpl-item>
</vn-autocomplete>
</vn-horizontal>
<vn-horizontal>

View File

@ -43,7 +43,8 @@ class Controller {
set warehouseFk(value) {
this.warehouse = value;
if (value && !window.localStorage.localWarehouseFk)
if (value &&
(!window.localStorage.localWarehouseFk || window.localStorage.localWarehouseFk === 'null'))
window.localStorage.defaultWarehouseFk = value;
this.setUserConfig('warehouseFk', value);
}
@ -54,7 +55,8 @@ class Controller {
set companyFk(value) {
this.company = value;
if (value && !window.localStorage.localCompanyFk)
if (value &&
(!window.localStorage.localCompanyFk || window.localStorage.localCompanyFk === 'null'))
window.localStorage.defaultCompanyFk = value;
this.setUserConfig('companyFk', value);
}
@ -103,8 +105,10 @@ class Controller {
}
$onInit() {
if (localStorage.getItem('localBankFk'))
window.localStorage.defaultBankFk = localStorage.getItem('localBankFk');
if (window.localStorage.localBankFk && window.localStorage.localBankFk !== 'null')
window.localStorage.defaultBankFk = window.localStorage.localBankFk;
else
localStorage.removeItem('defaultBankFk');
}
}