Openbravo Issue Tracking System - Retail Modules
View Issue Details
0039428Retail ModulesWeb POSpublic2018-07-20 12:462018-10-18 13:05
migueldejuana 
migueldejuana 
normalminoralways
closedfixed 
5
 
RR18Q3.2RR18Q3.2 
marvintm
No
0039428: 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.
blocks defect 0039009 closed migueldejuana Do not set terminalName with empty value 
Issue History
2018-10-09 19:03marvintmTypedefect => backport
2018-10-09 19:03marvintmTarget Version => RR18Q3.2
2018-10-16 16:24hgbotCheckin
2018-10-16 16:24hgbotNote Added: 0107341
2018-10-16 16:24hgbotStatusscheduled => resolved
2018-10-16 16:24hgbotResolutionopen => fixed
2018-10-16 16:24hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/196db31bb02f702c89cbca0778f4f6edd04f1684 [^] => http://code.openbravo.com/retail/backports/3.0RR18Q3.2/org.openbravo.mobile.core/rev/9c6008e24116a27620858cf38fb818f5401de608 [^]
2018-10-16 16:24hgbotCheckin
2018-10-16 16:24hgbotNote Added: 0107342
2018-10-16 16:24hgbotFixed in SCM revisionhttp://code.openbravo.com/retail/backports/3.0RR18Q3.2/org.openbravo.mobile.core/rev/9c6008e24116a27620858cf38fb818f5401de608 [^] => http://code.openbravo.com/retail/backports/3.0RR18Q3.2/org.openbravo.retail.posterminal/rev/1198e2c11bb4cba53468763f73d5fcb53a42576c [^]
2018-10-18 13:05marvintmStatusresolved => closed
2018-10-18 13:05marvintmFixed in Version => RR18Q3.2

Notes
(0107341)
hgbot   
2018-10-16 16:24   
Repository: retail/backports/3.0RR18Q3.2/org.openbravo.mobile.core
Changeset: 9c6008e24116a27620858cf38fb818f5401de608
Author: Miguel de Juana <miguel.dejuana <at> openbravo.com>
Date: Tue Oct 16 16:22:24 2018 +0200
URL: http://code.openbravo.com/retail/backports/3.0RR18Q3.2/org.openbravo.mobile.core/rev/9c6008e24116a27620858cf38fb818f5401de608 [^]

Fixed issue 0039428: 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
---
(0107342)
hgbot   
2018-10-16 16:24   
Repository: retail/backports/3.0RR18Q3.2/org.openbravo.retail.posterminal
Changeset: 1198e2c11bb4cba53468763f73d5fcb53a42576c
Author: Miguel de Juana <miguel.dejuana <at> openbravo.com>
Date: Tue Oct 16 16:23:15 2018 +0200
URL: http://code.openbravo.com/retail/backports/3.0RR18Q3.2/org.openbravo.retail.posterminal/rev/1198e2c11bb4cba53468763f73d5fcb53a42576c [^]

Fixed issue 0039428: 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
---