Openbravo Issue Tracking System - Retail Modules
View Issue Details
0039009Retail ModulesWeb POSpublic2018-07-20 12:462018-10-16 16:29
migueldejuana 
migueldejuana 
normalminoralways
closedfixed 
5
 
 
marvintm
No
0039009: Do not set terminalName with empty value
Since we added localStorage API, we save items in localStorage with the appName as prefix (WEBPOS.terminalName).
There is a case where we try to getItem but appName is not yet defined in OB.MobileApp.model, so we cannot get it from localStorage and we get null value.
Put a breakpoint in login-model.js in the line:

      me.setTerminalName(OB.UTIL.localStorage.getItem('terminalAuthentication', me.get('appName')) === 'Y' ? OB.UTIL.localStorage.getItem('terminalName', me.get('appName')) : OB.UTIL.getParameterByName("terminal"));

just before the line:

      OB.UTIL.HookManager.registerHook('OBMOBC_InitActions', function (args, c) {

Load web Pos and see that:

- OB.MobileApp.model is undefined so we cannot get the appName
- OB.UTIL.localStorage.getItem('terminalAuthentication') is null
- OB.UTIL.localStorage.getItem('terminalName')
Change the localStorage API adding the ability pass the appName. After this fix, we will be able to load items from localStorage before appName is defined in OB.MobileApp.model.

Example:
      me.setTerminalName(OB.UTIL.localStorage.getItem('terminalAuthentication', me.get('appName')) === 'Y' ? OB.UTIL.localStorage.getItem('terminalName', me.get('appName')) : OB.UTIL.getParameterByName("terminal"));

No tags attached.
related to defect 0039010 closed migueldejuana Delete cache deletion revision 
depends on backport 0039428RR18Q3.2 closed migueldejuana Do not set terminalName with empty value 
depends on backport 0039462RR18Q2.4 closed migueldejuana Do not set terminalName with empty value 
caused by feature request 0032582 closed jorge-garcia Stabilization: Create an API for the localStorage 
Issue History
2018-07-20 12:46migueldejuanaNew Issue
2018-07-20 12:46migueldejuanaAssigned To => migueldejuana
2018-07-20 12:46migueldejuanaTriggers an Emergency Pack => No
2018-07-20 12:50migueldejuanaRelationship addedcaused by 0032582
2018-07-20 12:55hgbotCheckin
2018-07-20 12:55hgbotNote Added: 0105836
2018-07-20 12:55hgbotStatusnew => resolved
2018-07-20 12:55hgbotResolutionopen => fixed
2018-07-20 12:55hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/e285e1acb64c88355eabf1ef3ad4c47af9475207 [^]
2018-07-20 12:59hgbotCheckin
2018-07-20 12:59hgbotNote Added: 0105837
2018-07-20 12:59hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/e285e1acb64c88355eabf1ef3ad4c47af9475207 [^] => http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/196db31bb02f702c89cbca0778f4f6edd04f1684 [^]
2018-07-20 14:08egoitzRelationship addedrelated to 0039010
2018-07-20 14:08egoitzIssue Monitored: egoitz
2018-07-26 16:30marvintmReview Assigned To => marvintm
2018-07-26 16:30marvintmStatusresolved => closed
2018-07-26 16:30marvintmFixed in Version => RR18Q4
2018-10-09 19:03marvintmStatusclosed => new
2018-10-09 19:03marvintmResolutionfixed => open
2018-10-09 19:03marvintmFixed in VersionRR18Q4 =>
2018-10-09 19:03marvintmStatusnew => scheduled
2018-10-09 19:03marvintmStatusscheduled => resolved
2018-10-09 19:03marvintmFixed in Version => RR18Q4
2018-10-09 19:03marvintmResolutionopen => fixed
2018-10-09 19:03marvintmStatusresolved => closed
2018-10-16 16:28migueldejuanaStatusclosed => new
2018-10-16 16:28migueldejuanaResolutionfixed => open
2018-10-16 16:28migueldejuanaFixed in VersionRR18Q4 =>
2018-10-16 16:28migueldejuanaStatusnew => scheduled
2018-10-16 16:29migueldejuanaStatusscheduled => resolved
2018-10-16 16:29migueldejuanaResolutionopen => fixed
2018-10-16 16:29migueldejuanaStatusresolved => closed

Notes
(0105836)
hgbot   
2018-07-20 12:55   
Repository: erp/pmods/org.openbravo.mobile.core
Changeset: e285e1acb64c88355eabf1ef3ad4c47af9475207
Author: Miguel de Juana <miguel.dejuana <at> openbravo.com>
Date: Fri Jul 20 12:55:22 2018 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/e285e1acb64c88355eabf1ef3ad4c47af9475207 [^]

Fixed issue 0039009: Do not set terminalName with empty value

- Add the ability to pass appName in case OB.MobileApp.model is not defined yet

---
M web/org.openbravo.mobile.core/source/utils/ob-localStorage.js
---
(0105837)
hgbot   
2018-07-20 12:59   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: 196db31bb02f702c89cbca0778f4f6edd04f1684
Author: Miguel de Juana <miguel.dejuana <at> openbravo.com>
Date: Fri Jul 20 12:59:25 2018 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/196db31bb02f702c89cbca0778f4f6edd04f1684 [^]

Fixed issue 0039009: Do not set terminalName with empty value

- At this point OB.MobileApp.model is not defined so we cannot get appName to get items from localStorage. All localStoragegetItem will return null because this problem(until OB.MobileApp.model is defined) As we already know the appName, pass it as parameter to loscalStorage API.

---
M web/org.openbravo.retail.posterminal/js/login/model/login-model.js
---