Openbravo Issue Tracking System - Retail Modules
View Issue Details
0034023Retail ModulesStoreServerpublic2016-09-19 22:262016-09-28 09:15
mtaal 
mtaal 
normalmajorhave not tried
closedfixed 
5
 
RR16Q4RR16Q4 
Sandrahuguet
No
0034023: JSON error unexpected token in remote BP data when saving address through customer
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
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
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.
depends on backport 0034026RR16Q3.2 closed mtaal JSON error unexpected token in remote BP data when saving address through customer - remove unnecessary json set 
related to defect 0035998 closed migueldejuana Javascript error editing the current customer on remote mode, using Terminal Authentication 
Issue History
2016-09-19 22:26mtaalNew Issue
2016-09-19 22:26mtaalAssigned To => mtaal
2016-09-19 22:26mtaalTriggers an Emergency Pack => No
2016-09-19 23:40mtaalStatusnew => scheduled
2016-09-19 23:45hgbotCheckin
2016-09-19 23:45hgbotNote Added: 0090092
2016-09-19 23:45hgbotStatusscheduled => resolved
2016-09-19 23:45hgbotResolutionopen => fixed
2016-09-19 23:45hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/c7609896cb418d5f6a32497d46fc6abd033cde79 [^]
2016-09-22 17:38mtaalReview Assigned To => Sandrahuguet
2016-09-22 17:38mtaalDescription Updatedbug_revision_view_page.php?rev_id=13163#r13163
2016-09-28 09:15SandrahuguetNote Added: 0090325
2016-09-28 09:15SandrahuguetStatusresolved => closed
2016-09-28 09:15SandrahuguetFixed in Version => RR16Q4
2017-05-16 16:28migueldejuanaRelationship addedrelated to 0035998

Notes
(0090092)
hgbot   
2016-09-19 23:45   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: c7609896cb418d5f6a32497d46fc6abd033cde79
Author: Martin Taal <martin.taal <at> openbravo.com>
Date: Mon Sep 19 23:45:16 2016 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/c7609896cb418d5f6a32497d46fc6abd033cde79 [^]

Fixes issue 33926: [STORE SERVER] Business partners are not updated when editing them in Web POS.
Save the changed bp/bploc in the local database and also refresh buttons

Fixes issue 34023: JSON error unexpected token in remote BP data when saving address through customer
Serialize json in the correct way

---
M web/org.openbravo.retail.posterminal/js/data/datacustomeraddrsave.js
M web/org.openbravo.retail.posterminal/js/data/datacustomersave.js
---
(0090325)
Sandrahuguet   
2016-09-28 09:15   
Reviewed and tested