Openbravo Issue Tracking System - Retail Modules | ||||||||||||||||||||||||||
View Issue Details | ||||||||||||||||||||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | |||||||||||||||||||||
0035998 | Retail Modules | Web POS | public | 2017-05-15 16:30 | 2017-05-29 13:59 | |||||||||||||||||||||
Reporter | aaroncalero | |||||||||||||||||||||||||
Assigned To | migueldejuana | |||||||||||||||||||||||||
Priority | high | Severity | major | Reproducibility | always | |||||||||||||||||||||
Status | closed | Resolution | fixed | |||||||||||||||||||||||
Platform | OS | 5 | OS Version | |||||||||||||||||||||||
Product Version | ||||||||||||||||||||||||||
Target Version | Fixed in Version | RR17Q3 | ||||||||||||||||||||||||
Merge Request Status | ||||||||||||||||||||||||||
Review Assigned To | guilleaer | |||||||||||||||||||||||||
OBNetwork customer | ||||||||||||||||||||||||||
Support ticket | ||||||||||||||||||||||||||
Regression level | ||||||||||||||||||||||||||
Regression date | ||||||||||||||||||||||||||
Regression introduced in release | ||||||||||||||||||||||||||
Regression introduced by commit | ||||||||||||||||||||||||||
Triggers an Emergency Pack | No | |||||||||||||||||||||||||
Summary | 0035998: Javascript error editing the current customer on remote mode, using Terminal Authentication | |||||||||||||||||||||||||
Description | When the Remote mode for customers is configured together with the Terminal Authentication preference, a javascript error might raise while trying to save changes done to the customer currently assigned to the receipt. The issue can be reproduced easily if the internet connection speed is slow, or if the OBPOS_PostCustomerSave hook includes several remote calls. | |||||||||||||||||||||||||
Steps To Reproduce | Using standard retail sampledata (livebuilds). Login in backend. Go to the Preference window and configure the following preferences: *Enable Remote for Customer with value 'Y' *Terminal Authentication enabled with value 'Y' Go to the POS Terminal window, find the VBS-1 terminal and define the Terminal Key Identifier as VBS1 Login in web pos, terminal VBS-1. The Terminal Authentication window will be shown. Enter the requested values. Once the application has logged in, open the browser console, go to the Network tab and enable a slow throttling (i.e. GPRS, 50kb/s). In web pos, open the customer selector popup and edit the VBS Customer record. Click on Save. A "SyntaxError: Unexpected token o in JSON at position 1" error will be raised and the customer edition won't be saved. | |||||||||||||||||||||||||
Proposed Solution | The functions defined on the datacustomersave.js file are in charge of saving and synchronizing modifications done to customers from webpos. The functions on this file use a reference to OB.Model.ChangedBusinessPartners, which is the model used to synchronize changes to business partners. The reference to that object, bpToSave, is used on different parts of the code, which asynchronously access and modify the object. Especifically, the OBPOS_PostCustomerSave hook is called twice using the same object ([1] and [2]). The callback of the first hook saves the model, then changes the json property of the object (assigning a js object instead of a string, corrupting the object and later causing the SyntaxError) and finally it tries to synchronize the customer. The callback of the second hook saves the same object again, and finally tries to synchronize the object again. If the connection speed is slow, the first hook finishes before reaching this point, so the 2nd synchronization is done using a corrupt BP object): This code should be refactored to call the hook only once, regardless of which flow is executed (create/update, either in remote or local mode). Also if the same object is going to be used across the code, the asynchrony should be controlled using callbacks, to ensure that the code is always executed in the same order. [1] https://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/file/12a71cc328da/web/org.openbravo.retail.posterminal/js/data/datacustomersave.js#l121 [^] [2] https://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/file/12a71cc328da/web/org.openbravo.retail.posterminal/js/data/datacustomersave.js#l197 [^] | |||||||||||||||||||||||||
Additional Information | ||||||||||||||||||||||||||
Tags | No tags attached. | |||||||||||||||||||||||||
Relationships |
| |||||||||||||||||||||||||
Attached Files | ||||||||||||||||||||||||||
Issue History | ||||||||||||||||||||||||||
Date Modified | Username | Field | Change | |||||||||||||||||||||||
2017-05-15 16:30 | aaroncalero | New Issue | ||||||||||||||||||||||||
2017-05-15 16:30 | aaroncalero | Assigned To | => Retail | |||||||||||||||||||||||
2017-05-15 16:30 | aaroncalero | Resolution time | => 1496008800 | |||||||||||||||||||||||
2017-05-15 16:30 | aaroncalero | Triggers an Emergency Pack | => No | |||||||||||||||||||||||
2017-05-16 16:28 | migueldejuana | Relationship added | related to 0033926 | |||||||||||||||||||||||
2017-05-16 16:28 | migueldejuana | Relationship added | related to 0034023 | |||||||||||||||||||||||
2017-05-19 09:15 | hgbot | Checkin | ||||||||||||||||||||||||
2017-05-19 09:15 | hgbot | Note Added: 0096670 | ||||||||||||||||||||||||
2017-05-19 09:15 | hgbot | Status | new => resolved | |||||||||||||||||||||||
2017-05-19 09:15 | hgbot | Resolution | open => fixed | |||||||||||||||||||||||
2017-05-19 09:15 | hgbot | Fixed in SCM revision | => http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/40bd1098c95802ebaebb1a09416604a056beebc9 [^] | |||||||||||||||||||||||
2017-05-19 11:16 | migueldejuana | Relationship added | related to 0036051 | |||||||||||||||||||||||
2017-05-25 12:13 | marvintm | Assigned To | Retail => migueldejuana | |||||||||||||||||||||||
2017-05-29 13:59 | guilleaer | Review Assigned To | => guilleaer | |||||||||||||||||||||||
2017-05-29 13:59 | guilleaer | Status | resolved => closed | |||||||||||||||||||||||
2017-05-29 13:59 | guilleaer | Fixed in Version | => RR17Q3 |
Notes | |||||
|
|||||
|
|