Openbravo Issue Tracking System - POS2
View Issue Details
0051282POS2POSpublic2023-01-03 15:312023-03-21 17:08
javierRodriguez 
meriem_azaf 
normalmajoralways
closedfixed 
5
 
23Q2 
No
0051282: If localStorage does not have latest safebox information, updated it with the information stored in the backend
Sometimes, the information about currently attached safebox is not up to date on localStorage (root cause of this will be addressed in another issue). When that happens, we could start the POS:
- assuming that a safebox is attached, when it has already been removed, or
- assuming that there is no safebox attached, when one is currently in the POS

We are going to assume that the backend will always have the most up to date information, so when login in we will:
- make a request to the backend to check if the terminal has currently a safebox attached
- use that information to update the localStorage
We can forcefully reproduce the problem like this:
- Configure the terminal to use safeboxes

A) Safebox attached, but localStorage does not have the latest information and thinks it is not attached

- Login, select a safebox
- Logout without doing cashup, safebox will stay in the terminal
- Forcefully remove the safebox by executing: OB.UTIL.localStorage.removeItem('currentSafeBox');

B) Safebox not attached, but localStorage does not have the latest information and thinks it is attached

- Login, select a safebox
- Do a cashup. Check that the safebox has been removed from localStorage by executing OB.UTIL.localStorage.getItem('currentSafeBox'); and checking that it returns null/undefined
- Forcefully update localStorage by executing OB.UTIL.localStorage.removeItem('currentSafeBox');


- Logout without doing cashup, safebox will stay in the terminal
- Forcefully remove the safebox by executing:
OB.UTIL.localStorage.setItem('currentSafeBox','{"safeBoxName":"Vall Blanca Safe Box 03","safeBoxId":"86E4C11FC0CF4A4782E6985AADBD0068","safeBoxCountOnRemove":false,"safeBoxSearchKey":"VBSB03","paymentMethods":[{"allowNotToMove":true,"safeBoxPaymentMethodId":"0A3E31C66F424C09B7BD93624B7439C2","amount":200,"keepFixedAmount":true,"countCash":true,"automateMovementToOtherAccount":true,"allowMoveEverything":true,"countDifferenceLimit":0,"paymentMethodId":"45A202BF44884F05B8A1BF741E2063B6","allowVariableAmount":true,"countPerAmount":false,"currency":"102","isCash":true,"financialAccountId":"16CAAB578E8246E0829DFF987103A3F8","safeBoxCounting":{"depositBalance":0,"paymentBalance":0,"initialBalance":0}}],"id":"86E4C11FC0CF4A4782E6985AADBD0068"}');
No tags attached.
depends on backport 005182223Q1.1 closed meriem_azaf If localStorage does not have latest safebox information, updated it with the information stored in the backend 
Issue History
2023-01-03 15:31javierRodriguezNew Issue
2023-01-03 15:31javierRodriguezAssigned To => AugustoMauch
2023-01-03 15:31javierRodriguezTriggers an Emergency Pack => No
2023-01-18 14:39AugustoMauchAssigned ToAugustoMauch => meriem_azaf
2023-01-18 14:46AugustoMauchSummaryVerify terminal values in initial count steps => Add log to inform about the relevant values when deciding what kind of initial count process should be triggered
2023-01-18 14:46AugustoMauchDescription Updatedbug_revision_view_page.php?rev_id=25411#r25411
2023-01-18 14:46AugustoMauchStatusnew => scheduled
2023-02-02 12:49guilleaerAssigned Tomeriem_azaf => AugustoMauch
2023-03-07 09:24guilleaerSummaryAdd log to inform about the relevant values when deciding what kind of initial count process should be triggered => When state perisitance problem appears -> Mitigate safe box selection
2023-03-07 09:24guilleaerDescription Updatedbug_revision_view_page.php?rev_id=25634#r25634
2023-03-09 12:52guilleaerStatusscheduled => acknowledged
2023-03-09 12:52guilleaerStatusacknowledged => scheduled
2023-03-13 09:34AugustoMauchAssigned ToAugustoMauch => meriem_azaf
2023-03-13 09:41AugustoMauchSummaryWhen state perisitance problem appears -> Mitigate safe box selection => If localStorage does not have latest safebox information, updated it with the information stored in the backend
2023-03-13 09:41AugustoMauchDescription Updatedbug_revision_view_page.php?rev_id=25670#r25670
2023-03-13 09:46AugustoMauchSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=25672#r25672
2023-03-17 15:23hgbotNote Added: 0147659
2023-03-17 15:29hgbotNote Added: 0147660
2023-03-20 11:28hgbotNote Added: 0147695
2023-03-21 15:31hgbotNote Added: 0147765
2023-03-21 15:32hgbotNote Added: 0147766
2023-03-21 15:32hgbotNote Added: 0147767
2023-03-21 15:32hgbotResolutionopen => fixed
2023-03-21 15:32hgbotStatusscheduled => closed
2023-03-21 15:32hgbotNote Added: 0147768
2023-03-21 15:32hgbotFixed in Version => 23Q2
2023-03-21 15:32hgbotNote Added: 0147769
2023-03-21 17:08hgbotNote Added: 0147776

Notes
(0147659)
hgbot   
2023-03-17 15:23   
Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.pos2/-/merge_requests/1599 [^]
(0147660)
hgbot   
2023-03-17 15:29   
Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.posterminal/-/merge_requests/1104 [^]
(0147695)
hgbot   
2023-03-20 11:28   
Merge request closed: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.posterminal/-/merge_requests/1104 [^]
(0147765)
hgbot   
2023-03-21 15:31   
Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.posterminal/-/merge_requests/1109 [^]
(0147766)
hgbot   
2023-03-21 15:32   
Repository: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.posterminal [^]
Changeset: fc92377635f709dc071198cdeaa10f9eed50eefc
Author: Augusto Mauch <augusto.mauch@openbravo.com>
Date: 21-03-2023 14:50:14
URL: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.posterminal/-/commit/fc92377635f709dc071198cdeaa10f9eed50eefc [^]

Related to ISSUE-51282: Stores in the cashup information is the previous cashup was already processed in the backend

This information will be used in mitigation efforts for some errors in POS2

---
M web-test/model/business-object/cashup/Cashup-InitCashup-ActionPreparation.test.js
M web/org.openbravo.retail.posterminal/app/model/business-object/cashup/actions/InitCashup.js
---
(0147767)
hgbot   
2023-03-21 15:32   
Merge request merged: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.posterminal/-/merge_requests/1109 [^]
(0147768)
hgbot   
2023-03-21 15:32   
Merge request merged: https://gitlab.com/openbravo/product/pmods/org.openbravo.pos2/-/merge_requests/1599 [^]
(0147769)
hgbot   
2023-03-21 15:32   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/pmods/org.openbravo.pos2 [^]
Changeset: 2503c032165bba335e1ec98a343da1bf406cd6ae
Author: Meriem Azaf <meriem.azaf@openbravo.com>
Date: 21-03-2023 14:44:00
URL: https://gitlab.com/openbravo/product/pmods/org.openbravo.pos2/-/commit/2503c032165bba335e1ec98a343da1bf406cd6ae [^]

Fixes ISSUE-51282: Not matching safeBox information between the localStorage and the backend

Sometimes, the information about currently attached safebox is not up to date on localStorage. When this has happened, the mechanism to mitigate the same
problem but applied to the cashup information is triggered.

In this issue, if the cashup mitigation was triggered, a request will be done to the backend to find out if the backend thinks there is a safebox attached
to the terminal. If there is not, but there seems to be a safebox attached on the local data, we will assume the local data is outdated and we will remove
the information about the currently attached safebox stored locally.

---
A src/org/openbravo/pos2/master/SafeBox.java
M src-db/database/sourcedata/OBMOBC_SERVICES.xml
M web-jspack/org.openbravo.pos2/src/authentication/loginInitActions.js
---
(0147776)
hgbot   
2023-03-21 17:08   
Repository: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.posterminal [^]
Changeset: 2d3f46d2c8b1796eeb63a84b2caf9f79975f1486
Author: Augusto Mauch <augusto.mauch@openbravo.com>
Date: 21-03-2023 17:06:23
URL: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.posterminal/-/commit/2d3f46d2c8b1796eeb63a84b2caf9f79975f1486 [^]

Related to ISSUE-51282: Stores in the cashup information is the previous cashup was already processed in the backend

This information will be used in mitigation efforts for some errors in POS2

---
M web-test/model/business-object/cashup/Cashup-InitCashup-ActionPreparation.test.js
M web/org.openbravo.retail.posterminal/app/model/business-object/cashup/actions/InitCashup.js
---