Openbravo Issue Tracking System - Retail Modules
View Issue Details
0032443Retail ModulesWeb POSpublic2016-03-09 11:362016-06-20 16:55
mtaal 
Sandrahuguet 
normalminorhave not tried
closedfixed 
5
 
RR16Q3RR16Q3 
mtaal
No
0032443: Prevent changing out-dated/stale data (ticket/BP) in webpos
With the current webpos version it is possible to load a ticket (layaway) in multiple terminals and change it in both, one change overwriting the other, or change it in the backoffice while it is already loaded in a webpos were it then get changed afterwards.

So it is possible that a ticket change is overwritten by ticket loaded earlier in webpos.

The same issue can arise with BP data.
run OB Commerce
start 2 browsers
load the same layaway in 2 browsers
change the layaway in both and submit one after the other
only one of the changes is saved
When sending a ticket/data to the server check if there has not already been a change in the data. If so then reject the transaction, throw an error with a nice user message.

To implement this:
- when loading data from the server include the updated timestamp
- then when changing this data and sending it back to the server send the original updated timestamp with it and check on the server if it hasn't changed since then
- if it has changed don't perform the transaction, instead throw an exception

Do this for tickets, BPs and BP addresses.
No tags attached.
related to defect 0034001 closed Sandrahuguet verify the updated date is not necessary in "prevent changing out-dated/stale data (ticket/BP)" feature 
causes defect 0033511 closed ranjith_qualiantech_com Error When completing layaway from backend with payment method discount 
causes defect 0034285 closed ranjith_qualiantech_com Customer can not be edited 
causes defect 0034466 closed ranjith_qualiantech_com Layaway payments not created with time offset 
Issue History
2016-03-09 11:36mtaalNew Issue
2016-03-09 11:36mtaalAssigned To => mtaal
2016-03-09 11:36mtaalTriggers an Emergency Pack => No
2016-03-09 11:36mtaalSummaryPrevent changing out-dated/stale ticket in webpos => Prevent changing out-dated/stale data (ticket/BP) in webpos
2016-03-09 11:36mtaalDescription Updatedbug_revision_view_page.php?rev_id=11393#r11393
2016-04-01 11:13mtaalNote Added: 0085381
2016-04-01 11:13mtaalAssigned Tomtaal => Sandrahuguet
2016-04-19 09:02SandrahuguetStatusnew => scheduled
2016-05-16 08:54hgbotCheckin
2016-05-16 08:54hgbotNote Added: 0086454
2016-05-16 08:54hgbotStatusscheduled => resolved
2016-05-16 08:54hgbotResolutionopen => fixed
2016-05-16 08:54hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/65a71ebd583ae7511c94526bc7fcdfe0c892c7f8 [^]
2016-05-16 08:57hgbotCheckin
2016-05-16 08:57hgbotNote Added: 0086455
2016-05-16 08:57hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/65a71ebd583ae7511c94526bc7fcdfe0c892c7f8 [^] => http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/c396d14324f8ca0baa52b18ba15c0033a6ef1f09 [^]
2016-05-16 08:58SandrahuguetReview Assigned To => mtaal
2016-05-16 09:12hgbotCheckin
2016-05-16 09:12hgbotNote Added: 0086456
2016-05-16 11:55hgbotCheckin
2016-05-16 11:55hgbotNote Added: 0086459
2016-06-01 10:27dmitry_mezentsevNote Added: 0086875
2016-06-06 17:15mtaalNote Added: 0087040
2016-06-06 17:15mtaalStatusresolved => new
2016-06-06 17:15mtaalResolutionfixed => open
2016-06-13 08:54hgbotCheckin
2016-06-13 08:54hgbotNote Added: 0087187
2016-06-14 08:25hgbotCheckin
2016-06-14 08:25hgbotNote Added: 0087219
2016-06-14 08:29SandrahuguetStatusnew => scheduled
2016-06-14 08:29SandrahuguetStatusscheduled => resolved
2016-06-14 08:29SandrahuguetResolutionopen => fixed
2016-06-14 10:42hgbotCheckin
2016-06-14 10:42hgbotNote Added: 0087237
2016-06-20 16:55mtaalNote Added: 0087683
2016-06-20 16:55mtaalStatusresolved => closed
2016-06-20 16:55mtaalFixed in Version => RR16Q3
2016-07-20 15:58ranjith_qualiantech_comRelationship addedcauses 0033511
2016-09-15 12:28SandrahuguetRelationship addedrelated to 0034001
2016-11-03 19:34dmitry_mezentsevRelationship addedcauses 0034285
2017-01-12 10:54ranjith_qualiantech_comRelationship addedcauses 0034466

Notes
(0085381)
mtaal   
2016-04-01 11:13   
Note: also handle the case that the json contains an updated record, while the record has not yet been created in the database. So the stale data timestamp should be used to detect both the case that the record was updated by the json while it doesn't yet exist or that the record in the database is stale.

So these cases:
1) Detect insert has not happened (can only really happen in case of multi-server):
- webpos A creates a BP on store server
- webpos A updates BP on store server, update message is also send to central
- central server receives the update BP message but notices that the BP does not yet exist, it can throw an exception or only a warning and try again in the next cycle

2) Later update happened hasn't been synced yet
- webpos A loads BP at 11:01 am and updates on store server
- webpos A loads BP again and 11:03 am and updates on store server
- last update is also send to central server, there it is detected that the first update hasn't happened yet, the choice is to wait or to throw an exception

3) Stale date
- webpos A loads BP at 11:01 am
- webpos B loads BP at 11:02 am
- webpos B updates BP at 11:03 am
- webpos A updates BP at 11:04 am --> should give error as the BP has been updated in the mean time
(0086454)
hgbot   
2016-05-16 08:54   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: 65a71ebd583ae7511c94526bc7fcdfe0c892c7f8
Author: Sandra Huguet <sandra.huguet <at> openbravo.com>
Date: Tue May 10 17:39:03 2016 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/65a71ebd583ae7511c94526bc7fcdfe0c892c7f8 [^]

Fixed issue 32443 Prevent changing out-dated data in webpos

---
M src-db/database/sourcedata/AD_MESSAGE.xml
M src/org/openbravo/retail/posterminal/CustomerAddrLoader.java
M src/org/openbravo/retail/posterminal/CustomerLoader.java
M src/org/openbravo/retail/posterminal/OrderLoader.java
M src/org/openbravo/retail/posterminal/master/BPLocationProperties.java
M src/org/openbravo/retail/posterminal/master/BusinessPartnerProperties.java
M web/org.openbravo.retail.posterminal/js/data/datacustomeraddrsave.js
M web/org.openbravo.retail.posterminal/js/data/datacustomersave.js
M web/org.openbravo.retail.posterminal/js/model/bplocation.js
M web/org.openbravo.retail.posterminal/js/model/businesspartner.js
M web/org.openbravo.retail.posterminal/js/model/order.js
M web/org.openbravo.retail.posterminal/js/pointofsale/view/subwindows/customeraddress/customeraddrdetailview.js
---
(0086455)
hgbot   
2016-05-16 08:57   
Repository: erp/pmods/org.openbravo.mobile.core
Changeset: c396d14324f8ca0baa52b18ba15c0033a6ef1f09
Author: Sandra Huguet <sandra.huguet <at> openbravo.com>
Date: Mon May 16 08:57:24 2016 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/c396d14324f8ca0baa52b18ba15c0033a6ef1f09 [^]

Fixed issue 32443 Prevent changing out-dated data in webpos

---
M src/org/openbravo/mobile/core/process/DataSynchronizationProcess.java
A src/org/openbravo/mobile/core/process/OutDatedDataChangeException.java
---
(0086456)
hgbot   
2016-05-16 09:12   
Repository: tools/automation/pi-mobile
Changeset: 14515ed225995c6321a8a7765867b2ff985828ef
Author: Sandra Huguet <sandra.huguet <at> openbravo.com>
Date: Tue May 10 17:43:19 2016 +0200
URL: http://code.openbravo.com/tools/automation/pi-mobile/rev/14515ed225995c6321a8a7765867b2ff985828ef [^]

related to issue 32443 Prevent changing out-dated data in webpos

---
M src-test/org/openbravo/test/mobile/common/selenium/utils/OBDate.java
M src-test/org/openbravo/test/mobile/retail/pack/webservice/tests/orderloader/RetailOrderLoaderTest.java
M src-test/org/openbravo/test/mobile/retail/pack/webservice/tests/orderloader/message-order-paypartial1-1.json
M src-test/org/openbravo/test/mobile/retail/pack/webservice/tests/orderloader/message-order-paypartial2-1.json
M src-test/org/openbravo/test/mobile/retail/pack/webservice/tests/orderloader/message-order-ship-1.json
---
(0086459)
hgbot   
2016-05-16 11:55   
Repository: erp/pmods/org.openbravo.mobile.core
Changeset: 5f40cfe8c9e648bc79105d450ff72d9706368ac7
Author: Sandra Huguet <sandra.huguet <at> openbravo.com>
Date: Mon May 16 11:54:38 2016 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/5f40cfe8c9e648bc79105d450ff72d9706368ac7 [^]

related to issue 32443 fixed javadoc

---
M src/org/openbravo/mobile/core/process/OutDatedDataChangeException.java
---
(0086875)
dmitry_mezentsev   
2016-06-01 10:27   
Not closed for 16 days!
(0087040)
mtaal   
2016-06-06 17:15   
Hi,
It worked but the logging of the customer/customer addr stale update didn't happen. The result of the call to messageBD has to be given to log.warn method.
In both CustomerLoader and CustomerAddrLoader.

Also, can you add a testcase which does the following:
- set the synchronized mode preference
- open a layaway
- change the layaway in the database directly
- add a payment to the layaway
- press done
--> a error message should pop up
- at the end of the test the synchronized pref needs to be removed
(0087187)
hgbot   
2016-06-13 08:54   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: 15381b93c214a4d672d97e4ce37d954d458d20f6
Author: Sandra Huguet <sandra.huguet <at> openbravo.com>
Date: Thu Jun 09 17:46:43 2016 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/15381b93c214a4d672d97e4ce37d954d458d20f6 [^]

related to issue 32443 result of the call to messageBD has to be given to log.warn

---
M src/org/openbravo/retail/posterminal/CustomerAddrLoader.java
M src/org/openbravo/retail/posterminal/CustomerLoader.java
---
(0087219)
hgbot   
2016-06-14 08:25   
Repository: tools/automation/pi-mobile
Changeset: ba885cc69793eae32e4c45f923b5e251ae7c9d3a
Author: Sandra Huguet <sandra.huguet <at> openbravo.com>
Date: Tue Jun 14 08:17:18 2016 +0200
URL: http://code.openbravo.com/tools/automation/pi-mobile/rev/ba885cc69793eae32e4c45f923b5e251ae7c9d3a [^]

related to issue 32443 added I32443_LayawayStaleData test

---
M src-test/org/openbravo/test/mobile/common/selenium/utils/AllowedErrorsHelper.java
A src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/layaway/I32443_LayawayStaleData.java
---
(0087237)
hgbot   
2016-06-14 10:42   
Repository: tools/automation/pi-mobile
Changeset: d6b192a7064b87664c436d6cbac2d36cfd9aa72e
Author: Sandra Huguet <sandra.huguet <at> openbravo.com>
Date: Tue Jun 14 10:41:59 2016 +0200
URL: http://code.openbravo.com/tools/automation/pi-mobile/rev/d6b192a7064b87664c436d6cbac2d36cfd9aa72e [^]

related to issue 32443 delete unnecessary code

---
M src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/layaway/I32443_LayawayStaleData.java
---
(0087683)
mtaal   
2016-06-20 16:55   
Reviewed and tested