Anonymous | Login
Project:
RSS
  
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0050321
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Retail Modules] Web POSmajorhave not tried2022-09-23 12:002022-10-21 13:02
ReporteraferrazView Statuspublic 
Assigned Tocaristu 
PrioritynormalResolutionfixedFixed in VersionRR23Q1
StatusclosedFix in branchFixed in SCM revision
ProjectionnoneETAnoneTarget Version
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned To
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0050321: LoginDataProvider.getData overwrites data defined for the same property instead of merging it

DescriptionThe 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.
Steps To Reproduce- 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.
Proposed SolutionAttached 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 [^]
TagsNo tags attached.
Attached Filesdiff file icon 50321.diff [^] (1,388 bytes) 2022-09-23 12:03 [Show Content]

- Relationships Relation Graph ] Dependency Graph ]
related to defect 0050602 closedcaristu Retail Modules API Change: LoginDataProvider extends Prioritizable 
related to defect 0056065 closedTriage Platform Base POS2 MobileCoreLoginUtilsServletTest.extraLoginDataIsMerged test fails 
blocks feature request 0050230 closedaferraz Retail Modules Implement open/close store process in ReactPOS 

-  Notes
(0142330)
hgbot (developer)
2022-10-20 10:37

Merge Request created: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/737 [^]
(0142331)
hgbot (developer)
2022-10-20 10:49

Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.mobile.core/-/merge_requests/424 [^]
(0142400)
hgbot (developer)
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 (developer)
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 (developer)
2022-10-21 12:24

Merge request merged: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/737 [^]
(0142405)
hgbot (developer)
2022-10-21 12:25

Merge request merged: https://gitlab.com/openbravo/product/pmods/org.openbravo.mobile.core/-/merge_requests/424 [^]
(0142406)
hgbot (developer)
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 (developer)
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
---

- Issue History
Date Modified Username Field Change
2022-09-23 12:00 aferraz New Issue
2022-09-23 12:00 aferraz Assigned To => Triage Platform Base
2022-09-23 12:00 aferraz Triggers an Emergency Pack => No
2022-09-23 12:03 aferraz File Added: 50321.diff
2022-10-18 17:28 caristu Assigned To Triage Platform Base => caristu
2022-10-20 10:37 hgbot Note Added: 0142330
2022-10-20 10:49 hgbot Note Added: 0142331
2022-10-21 08:26 aferraz Relationship added blocks 0050230
2022-10-21 10:13 caristu Description Updated View Revisions
2022-10-21 10:13 caristu Steps to Reproduce Updated View Revisions
2022-10-21 10:13 caristu Proposed Solution updated
2022-10-21 10:19 caristu Issue cloned 0050602
2022-10-21 10:19 caristu Relationship added related to 0050602
2022-10-21 12:24 hgbot Note Added: 0142400
2022-10-21 12:24 hgbot Note Added: 0142401
2022-10-21 12:24 hgbot Note Added: 0142402
2022-10-21 12:25 hgbot Note Added: 0142405
2022-10-21 12:25 hgbot Resolution open => fixed
2022-10-21 12:25 hgbot Status new => closed
2022-10-21 12:25 hgbot Fixed in Version => RR23Q1
2022-10-21 12:25 hgbot Note Added: 0142406
2022-10-21 13:02 hgbot Note Added: 0142414
2024-07-19 10:18 caristu Relationship added related to 0056065


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker