Openbravo Issue Tracking System - Retail Modules
View Issue Details
0050321Retail ModulesWeb POSpublic2022-09-23 12:002022-10-21 13:02
aferraz 
caristu 
normalmajorhave not tried
closedfixed 
5
 
RR23Q1 
No
0050321: LoginDataProvider.getData overwrites data defined for the same property instead of merging it
The MobileCoreLoginUtilsServlet generates a JSON object as the the response data with information that is loaded in the POS during the login process.

The LoginDataProvider hooks are intended to add custom data (with external modules) into that JSON object. But currently they do not support appending information into the inner JSON properties of the response data: they now can just overwrite it. This prevents including some information properly in the response data.
- Implement LoginDataProvider.getData and return a Map with "terminal" as key and any JSONObject as value.
- Clean the cache in ReactPOS and login -> You get following error: Cannot read properties of undefined (reading 'minutestorefreshdatatotal') -> This is caused because the LoginDataProvider hook is overwriting the terminal data that is previously generated by the MobileCoreLoginUtilsServlet.
Attached a fix to do a first level merge of properties with a JSONObject value.
Check if we should do a deep merge.
Check if other type of values like JSONArray should be also merged.

An example that would need this fix can be found here: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.sessions/-/merge_requests/43/diffs#1acedf184c743325e8df5d4acaa0404b719cff2d_0_29 [^]
No tags attached.
related to defect 0050602 closed caristu Retail Modules API Change: LoginDataProvider extends Prioritizable 
related to defect 0056065 closed Triage Platform Base POS2 MobileCoreLoginUtilsServletTest.extraLoginDataIsMerged test fails 
blocks feature request 0050230 closed aferraz Retail Modules Implement open/close store process in ReactPOS 
diff 50321.diff (1,388) 2022-09-23 12:03
https://issues.openbravo.com/file_download.php?file_id=17547&type=bug
Issue History
2022-09-23 12:00aferrazNew Issue
2022-09-23 12:00aferrazAssigned To => Triage Platform Base
2022-09-23 12:00aferrazTriggers an Emergency Pack => No
2022-09-23 12:03aferrazFile Added: 50321.diff
2022-10-18 17:28caristuAssigned ToTriage Platform Base => caristu
2022-10-20 10:37hgbotNote Added: 0142330
2022-10-20 10:49hgbotNote Added: 0142331
2022-10-21 08:26aferrazRelationship addedblocks 0050230
2022-10-21 10:13caristuDescription Updatedbug_revision_view_page.php?rev_id=24951#r24951
2022-10-21 10:13caristuSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=24953#r24953
2022-10-21 10:13caristuProposed Solution updated
2022-10-21 10:19caristuIssue cloned0050602
2022-10-21 10:19caristuRelationship addedrelated to 0050602
2022-10-21 12:24hgbotNote Added: 0142400
2022-10-21 12:24hgbotNote Added: 0142401
2022-10-21 12:24hgbotNote Added: 0142402
2022-10-21 12:25hgbotNote Added: 0142405
2022-10-21 12:25hgbotResolutionopen => fixed
2022-10-21 12:25hgbotStatusnew => closed
2022-10-21 12:25hgbotFixed in Version => RR23Q1
2022-10-21 12:25hgbotNote Added: 0142406
2022-10-21 13:02hgbotNote Added: 0142414
2024-07-19 10:18caristuRelationship addedrelated to 0056065

Notes
(0142330)
hgbot   
2022-10-20 10:37   
Merge Request created: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/737 [^]
(0142331)
hgbot   
2022-10-20 10:49   
Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.mobile.core/-/merge_requests/424 [^]
(0142400)
hgbot   
2022-10-21 12:24   
Repository: https://gitlab.com/openbravo/product/openbravo [^]
Changeset: 9919974506b080c80010485cf8535585bde0e84b
Author: Carlos Aristu <carlos.aristu@openbravo.com>
Date: 20-10-2022 08:49:16
URL: https://gitlab.com/openbravo/product/openbravo/-/commit/9919974506b080c80010485cf8535585bde0e84b [^]

related to BUG-50321: HttpServlet test utilities

 - Improve the HttpServletRequestMock to be able to set request
parameters
 - Create a mock to be able to work with HttpServletResponse in tests

---
A src-test/src/org/openbravo/test/base/mock/HttpServletResponseMock.java
M src-test/src/org/openbravo/test/base/mock/HttpServletRequestMock.java
---
(0142401)
hgbot   
2022-10-21 12:24   
Repository: https://gitlab.com/openbravo/product/openbravo [^]
Changeset: 3ad436efe3b435b1e0c364a595c0fdfd68d7e0bf
Author: Carlos Aristu <carlos.aristu@openbravo.com>
Date: 21-10-2022 12:07:46
URL: https://gitlab.com/openbravo/product/openbravo/-/commit/3ad436efe3b435b1e0c364a595c0fdfd68d7e0bf [^]

related to BUG-50321: utility methods to merge JSON objects

---
A src-test/src/org/openbravo/service/json/JsonUtilsTest.java
M modules/org.openbravo.service.json/src/org/openbravo/service/json/JsonUtils.java
M src-test/src/org/openbravo/test/StandaloneTestSuite.java
---
(0142402)
hgbot   
2022-10-21 12:24   
Merge request merged: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/737 [^]
(0142405)
hgbot   
2022-10-21 12:25   
Merge request merged: https://gitlab.com/openbravo/product/pmods/org.openbravo.mobile.core/-/merge_requests/424 [^]
(0142406)
hgbot   
2022-10-21 12:25   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/pmods/org.openbravo.mobile.core [^]
Changeset: fcc132ab328df65978ac249d930495c86e4d3307
Author: Carlos Aristu <carlos.aristu@openbravo.com>
Date: 21-10-2022 10:24:25
URL: https://gitlab.com/openbravo/product/pmods/org.openbravo.mobile.core/-/commit/fcc132ab328df65978ac249d930495c86e4d3307 [^]

fixes BUG-50321: merge JSON properties for extra login data

  Now it is possible to merge information coming from LoginDataProvider
hooks in JSON properties. Before this change, if the property already
existed in the result it was being overridden with the value returned
from the hook.

  Together with this, now the LoginDataProvider implements the
Prioritizable interface so it is possible to define an order, if
desired, to add the custom information from the hooks.

---
A src-test/org/openbravo/mobile/core/login/MobileCoreLoginUtilsServletTest.java
A src-test/org/openbravo/mobile/core/login/TestLoginDataProvider.java
M src/org/openbravo/mobile/core/login/LoginDataProvider.java
M src/org/openbravo/mobile/core/login/MobileCoreLoginUtilsServlet.java
---
(0142414)
hgbot   
2022-10-21 13:02   
Repository: https://gitlab.com/openbravo/product/openbravo [^]
Changeset: f8ac0c47ed4bbcc2417dd6c5cdc77bf8f9856797
Author: Carlos Aristu <carlos.aristu@openbravo.com>
Date: 21-10-2022 13:01:57
URL: https://gitlab.com/openbravo/product/openbravo/-/commit/f8ac0c47ed4bbcc2417dd6c5cdc77bf8f9856797 [^]

related to BUG-50321: avoid NPE

---
M src-test/src/org/openbravo/test/base/mock/HttpServletRequestMock.java
---