From 567f5aaa78d5e90c70f263f75a4c3653a4632f99 Mon Sep 17 00:00:00 2001 From: Gerard Date: Fri, 25 Jan 2019 12:24:07 +0100 Subject: [PATCH] fixed bug localBank being null --- .../components/user-configuration-popover/index.html | 2 ++ .../components/user-configuration-popover/index.js | 12 ++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/front/salix/components/user-configuration-popover/index.html b/front/salix/components/user-configuration-popover/index.html index 1c771c713..b43ecdf62 100644 --- a/front/salix/components/user-configuration-popover/index.html +++ b/front/salix/components/user-configuration-popover/index.html @@ -41,7 +41,9 @@ data="banksData" select-fields="['id','bank']" show-field="bank" + order="id" value-field="id"> + {{id}}: {{bank}} diff --git a/front/salix/components/user-configuration-popover/index.js b/front/salix/components/user-configuration-popover/index.js index ddade39bb..2ee77485d 100644 --- a/front/salix/components/user-configuration-popover/index.js +++ b/front/salix/components/user-configuration-popover/index.js @@ -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'); } }