Openbravo Issue Tracking System - Retail Modules
View Issue Details
0039393Retail ModulesWeb POSpublic2018-09-05 12:202018-10-22 18:20
marvintm 
migueldejuana 
urgentmajorrandom
closedfixed 
5
 
RR18Q3.2RR18Q3.2 
marvintm
No
0039393: Receipt object is global and therefore can be modified after the user has confirmed that the ticket should be processed
Currently the receipt object is global, accessible by different asynchronous processes, and therefore as the process to complete the receipt is asynchronous, it is possible that modifications happen after the user has confirmed that the ticket should be processed.

It is not possible to avoid the execution of parallel asynchronous processes. However, it is possible to avoid that the execution of these processes changes the information of the current receipt, by cloning the information of the ticket synchronously when the ticket completion process starts, so that from that point on, the cloned ticket is used to execute the completion process.
Due to the nature of the issue, the main problems it causes are only visible randomly in different ways. An example of an issue caused indirectly by this problem is the following:

https://issues.openbravo.com/view.php?id=39219 [^]
- Ticket should be cloned in a synchronized way at the start of the ticket completion process.
- The clone of the ticket should be used by the remaining actions in the ticket completion process.
- Even though the WebSQL database could in theory be a problem as it is another global point shared by all processes, so another process could save, and therefore overwrite the ticket with incorrect or outdated information in theory, in practice this should no longer be possible due to the implementation of the "hasbeenmodified" check while saving the record, which should prevent this problem from happening.
No tags attached.
blocks design defect 0039228 closed migueldejuana Receipt object is global and therefore can be modified after the user has confirmed that the ticket should be processed 
Issue History
2018-10-03 09:26migueldejuanaTypedesign defect => backport
2018-10-03 09:26migueldejuanaTarget Version => RR18Q3.2
2018-10-03 10:32hgbotCheckin
2018-10-03 10:32hgbotNote Added: 0107130
2018-10-03 10:32hgbotStatusscheduled => resolved
2018-10-03 10:32hgbotResolutionopen => fixed
2018-10-03 10:32hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/cfb6a93c38e8961d10cd7364d1337287a255a182 [^] => http://code.openbravo.com/retail/backports/3.0RR18Q3.2/org.openbravo.mobile.core/rev/0c4165dc7b42df58fad18c8efcba47f70f84d6a4 [^]
2018-10-03 10:35hgbotCheckin
2018-10-03 10:35hgbotNote Added: 0107131
2018-10-03 10:35hgbotFixed in SCM revisionhttp://code.openbravo.com/retail/backports/3.0RR18Q3.2/org.openbravo.mobile.core/rev/0c4165dc7b42df58fad18c8efcba47f70f84d6a4 [^] => http://code.openbravo.com/retail/backports/3.0RR18Q3.2/org.openbravo.retail.posterminal/rev/e3f0b5b5a9d827f9e0dd49b110674599cf8cdfbc [^]
2018-10-04 11:54hgbotCheckin
2018-10-04 11:54hgbotNote Added: 0107155
2018-10-04 11:54hgbotFixed in SCM revisionhttp://code.openbravo.com/retail/backports/3.0RR18Q3.2/org.openbravo.retail.posterminal/rev/e3f0b5b5a9d827f9e0dd49b110674599cf8cdfbc [^] => http://code.openbravo.com/retail/backports/3.0RR18Q3.2/org.openbravo.retail.posterminal/rev/262b20c76539e953ea7bf0d6b5e6039961ef2690 [^]
2018-10-19 12:14marvintmStatusresolved => closed
2018-10-19 12:14marvintmFixed in Version => RR18Q3.2
2018-10-22 14:31hgbotCheckin
2018-10-22 14:31hgbotNote Added: 0107482
2018-10-22 14:31hgbotStatusclosed => resolved
2018-10-22 14:31hgbotFixed in SCM revisionhttp://code.openbravo.com/retail/backports/3.0RR18Q3.2/org.openbravo.retail.posterminal/rev/262b20c76539e953ea7bf0d6b5e6039961ef2690 [^] => http://code.openbravo.com/erp/pmods/org.openbravo.retail.stockvalidation/rev/4c5f7e3fdd0ded3fdc6b8c3444e6d447624829e5 [^]
2018-10-22 18:20marvintmStatusresolved => closed

Notes
(0107130)
hgbot   
2018-10-03 10:32   
Repository: retail/backports/3.0RR18Q3.2/org.openbravo.mobile.core
Changeset: 0c4165dc7b42df58fad18c8efcba47f70f84d6a4
Author: Miguel de Juana <miguel.dejuana <at> openbravo.com>
Date: Wed Oct 03 10:31:54 2018 +0200
URL: http://code.openbravo.com/retail/backports/3.0RR18Q3.2/org.openbravo.mobile.core/rev/0c4165dc7b42df58fad18c8efcba47f70f84d6a4 [^]

Fixed issue 0039393: Receipt object is global and therefore can be modified after the user has confirmed that the ticket should be processed

- Instead of do a get and then an update, do directly and update checking the column hasbeenpaid instead of the json.

---
M web/org.openbravo.mobile.core/source/data/ob-dal.js
---
(0107131)
hgbot   
2018-10-03 10:35   
Repository: retail/backports/3.0RR18Q3.2/org.openbravo.retail.posterminal
Changeset: e3f0b5b5a9d827f9e0dd49b110674599cf8cdfbc
Author: Miguel de Juana <miguel.dejuana <at> openbravo.com>
Date: Wed Oct 03 10:35:21 2018 +0200
URL: http://code.openbravo.com/retail/backports/3.0RR18Q3.2/org.openbravo.retail.posterminal/rev/e3f0b5b5a9d827f9e0dd49b110674599cf8cdfbc [^]

Fixed issue 0039393: Receipt object is global and therefore can be modified after the user has confirmed that the ticket should be processed

- Remove unnedeed save after the order is frozen
- Freeze the receipt to avoid overridding the object before sending it to the backend.
- Keep the diff validation (diffReceipt)
- Do a clearWith with frozenReceipt over receipt to set al values and launch all changes events
- Launch triggers over receipt to launch listeners
- Do the clearWith of the frozenReceipt before creating next order
- Save before in the code in Multiorders Layaways coming from server
- Do not save locally quotations and cancel orders
- Do not save frozenReceiptif hasbeenpaid='Y'
. Set again diffReceipt with the frozenReceipt
- Do not save frozenReceipt after sync it
- Restore receipt, frozenReceipt is just to send it to the server

---
M web/org.openbravo.retail.posterminal/js/components/modalmultiorders.js
M web/org.openbravo.retail.posterminal/js/data/dataordersave.js
M web/org.openbravo.retail.posterminal/js/model/order.js
M web/org.openbravo.retail.posterminal/js/pointofsale/view/pointofsale.js
M web/org.openbravo.retail.posterminal/js/utils/ticketCloseUtils.js
---
(0107155)
hgbot   
2018-10-04 11:54   
Repository: retail/backports/3.0RR18Q3.2/org.openbravo.retail.posterminal
Changeset: 262b20c76539e953ea7bf0d6b5e6039961ef2690
Author: Miguel de Juana <miguel.dejuana <at> openbravo.com>
Date: Thu Oct 04 11:53:50 2018 +0200
URL: http://code.openbravo.com/retail/backports/3.0RR18Q3.2/org.openbravo.retail.posterminal/rev/262b20c76539e953ea7bf0d6b5e6039961ef2690 [^]

Fixed issue 0039393: Receipt object is global and therefore can be modified after the user has confirmed that the ticket should be processed

- Missing change to set json

---
M web/org.openbravo.retail.posterminal/js/data/dataordersave.js
---
(0107482)
hgbot   
2018-10-22 14:31   
Repository: erp/pmods/org.openbravo.retail.stockvalidation
Changeset: 4c5f7e3fdd0ded3fdc6b8c3444e6d447624829e5
Author: Miguel de Juana <miguel.dejuana <at> openbravo.com>
Date: Thu Sep 27 10:37:47 2018 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.stockvalidation/rev/4c5f7e3fdd0ded3fdc6b8c3444e6d447624829e5 [^]

Fixed issue 39393: Receipt object is global and therefore can be modified after the user has confirmed that the ticket should be processed

- We do a clearWith using frozenReceipt and this launches again stockvalidation. Avoid this

---
M web/org.openbravo.retail.stockvalidation/js/modals.js
---