Openbravo Issue Tracking System - Retail Modules
View Issue Details
0034026Retail ModulesStoreServerpublic2016-09-19 22:262016-09-29 17:28
mtaal 
mtaal 
normalmajorhave not tried
closedfixed 
5
 
RR16Q3.2 
migueldejuana
No
0034026: JSON error unexpected token in remote BP data when saving address through customer - remove unnecessary json set
Solve two issues:
1) json error when saving customer
2) unnecessary and incorrect setting of json property in object

When editing and saving an address through the customer then the error ' Unexpected token o in JSON at position 1' is reported.

Strack trace:

ce25035…_WebPOS.js:2856 SyntaxError: Unexpected token o in JSON at position 1
    at http://store1.openbravo.com:8080/openbravo/web/js/gen/ce2503585cded83ecbab0c78d4c7719d_WebPOS.js:7314:32 [^]
    at Array.forEach (native)
    at Function.b.each.b.forEach (http://store1.openbravo.com:8080/openbravo/web/org.openbravo.mobile.core/lib/vendor/underscore-1.3.3.min.js:11:39 [^])
    at r.(anonymous function) [as each] (http://store1.openbravo.com:8080/openbravo/web/org.openbravo.mobile.core/lib/vendor/backbone-0.9.2.min.js:25:314 [^])
    at http://store1.openbravo.com:8080/openbravo/web/js/gen/ce2503585cded83ecbab0c78d4c7719d_WebPOS.js:7312:21 [^]
    at processResult (http://store1.openbravo.com:8080/openbravo/web/js/gen/ce2503585cded83ecbab0c78d4c7719d_WebPOS.js:4180:11 [^]); line: Object.OB.UTIL.showError (http://store1.openbravo.com:8080/openbravo/web/js/gen/ce2503585cded83ecbab0c78d4c7719d_WebPOS.js:11173:6 [^]) (*,+)processConsoleLevel @ ce25035…_WebPOS.js:2856OB.error @ ce25035…_WebPOS.js:2886OB.UTIL.showError @ ce25035…_WebPOS.js:11173window.onerror @ ce25035…_WebPOS.js:22654
VM87:1 Uncaught SyntaxError: Unexpected token o in JSON at position 1
Topic 1:
Set remote BP properties
Login to webpos
Click on Menu
Select Customers
Search any customer
Click on customer
click on create new address
Create a new address
Save

Note the error only occurs if you first go through the customers menu not when going through the customer/address button

Topic 2:
Put breakpoints in the changed locations and check what is being set in the object's json property
The error is caused by this line:
bpLocToSave.set('json', customerAddr.serializeToJSON());

Here:
https://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/file/200182f3db29/web/org.openbravo.retail.posterminal/js/data/datacustomeraddrsave.js#l57 [^]

It must be changed to:
bpLocToSave.set('json', JSON.stringify(customerAddr.serializeToJSON()));
No tags attached.
blocks defect 0034023RR16Q4 closed mtaal JSON error unexpected token in remote BP data when saving address through customer 
blocks defect 0034077RR16Q4 closed mtaal Unnecessary set of json property with wrong value when saving cusotmer(address) 
Issue History
2016-09-19 23:40mtaalTypedefect => backport
2016-09-19 23:40mtaalTarget VersionRR16Q4 => RR16Q3.3
2016-09-25 12:18mtaalRelationship addedblocks 0034077
2016-09-25 12:19mtaalTarget VersionRR16Q3.3 => RR16Q3.2
2016-09-25 12:19mtaalSummaryJSON error unexpected token in remote BP data when saving address through customer => JSON error unexpected token in remote BP data when saving address through customer - remove unnecessary json set
2016-09-25 12:19mtaalDescription Updatedbug_revision_view_page.php?rev_id=13180#r13180
2016-09-25 12:20mtaalReview Assigned To => migueldejuana
2016-09-25 12:20mtaalSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=13182#r13182
2016-09-25 14:42mtaalNote Added: 0090232
2016-09-25 14:42hgbotCheckin
2016-09-25 14:42hgbotNote Added: 0090234
2016-09-25 14:42hgbotStatusscheduled => resolved
2016-09-25 14:42hgbotResolutionopen => fixed
2016-09-25 14:42hgbotFixed in SCM revision => http://code.openbravo.com/retail/backports/3.0RR16Q3.2/org.openbravo.retail.posterminal/rev/4eeb7af92ff117002a3ec8ed9d46f504aab680c4 [^]
2016-09-29 17:28migueldejuanaNote Added: 0090385
2016-09-29 17:28migueldejuanaStatusresolved => closed

Notes
(0090232)
mtaal   
2016-09-25 14:42   
In the end the solution was to remove all the lines which made no sense to have anyway and which were incorrect.
(0090234)
hgbot   
2016-09-25 14:42   
Repository: retail/backports/3.0RR16Q3.2/org.openbravo.retail.posterminal
Changeset: 4eeb7af92ff117002a3ec8ed9d46f504aab680c4
Author: Martin Taal <martin.taal <at> openbravo.com>
Date: Sun Sep 25 14:42:19 2016 +0200
URL: http://code.openbravo.com/retail/backports/3.0RR16Q3.2/org.openbravo.retail.posterminal/rev/4eeb7af92ff117002a3ec8ed9d46f504aab680c4 [^]

Fixes issue 34026: JSON error unexpected token in remote BP data when saving address through customer - remove unnecessary json set
Removed unneeded and incorrect lines

---
M web/org.openbravo.retail.posterminal/js/data/datacustomeraddrsave.js
M web/org.openbravo.retail.posterminal/js/data/datacustomersave.js
---
(0090385)
migueldejuana   
2016-09-29 17:28   
Tested and reviewed