details:   https://code.openbravo.com/erp/devel/main/rev/238d1df72a67
changeset: 25031:238d1df72a67
user:      Eduardo Argal Guibert <eduardo.argal <at> openbravo.com>
date:      Fri Oct 03 18:01:03 2014 +0200
summary:   Fixes bug 27765: Landed Cost Costs accounting is broken when line is 
matching Adjusted

Amount was not wrong when no adjustment was required

details:   https://code.openbravo.com/erp/devel/main/rev/4e33ff811eb2
changeset: 25032:4e33ff811eb2
user:      Augusto Mauch <augusto.mauch <at> openbravo.com>
date:      Tue Oct 21 11:28:25 2014 +0200
summary:   Fixes issue 27918: User Defined Accounting Report Setup shows tree 
view

The problem was that the tree configuration previous to the new tree 
implementation was wrong. The Table table had a field called Type Area which 
was originally used to specify the Tree type of the table. The 
FinancialMgmtAccountingRptElement table had this field empty, and instead the 
FinancialMgmtAccountingReport had this field set to Accounting Report, which is 
the value that should have been assigned to FinancialMgmtAccountingRptElement.

The configuration of the new implementation was done based on the Tree Type 
field, so it was wrong for the FinancialMgmtAccountingRptElement table. Now it 
has been properly done (it has been flagged as Is Tree, a record has been added 
to the Table Tree Category subtab and a value has been selected in the Table 
Tree Category field of the Tab tab.

Also, a module script has been modified to fix the data of ad_tree. The ad_tree 
table has a column called ad_table_id, which points to the table that the tree 
belongs to. The accounting report tree was mistakenly pointing to 
FinancialMgmtAccountingReport, and the updated modulescript fixes it so that 
now it points to FinancialMgmtAccountingRptElement.

details:   https://code.openbravo.com/erp/devel/main/rev/a725a37f5269
changeset: 25033:a725a37f5269
user:      Augusto Mauch <augusto.mauch <at> openbravo.com>
date:      Tue Oct 21 13:09:51 2014 +0200
summary:   Fixes issue 27918, fixes issue 27930. Prevents breaking the int-inc 
tests

The problem was that due to this design defect [1], the oracle and postgres 
int-inc tests were failing. This is because a value 'AR' was being set to the 
treetype of a table and then being set to null in other table whose treetype 
was also 'AR'. Treetype has a unique constraint that was enabled when the 
application data was updated, so the constraint failed.

To prevent this error, the treetype of the second table is going to be set to 
null in a modulescript, that is executed before updating the application data.

[1] https://issues.openbravo.com/view.php?id=12577

details:   https://code.openbravo.com/erp/devel/main/rev/41f41e23bb48
changeset: 25034:41f41e23bb48
user:      Augusto Mauch <augusto.mauch <at> openbravo.com>
date:      Tue Oct 21 16:18:05 2014 +0200
summary:   Fixes issue 27918: Removes tree structure from table that is not a 
tree

In the initial changeset for fixing 27918, the tree type of the 
FinancialMgmtAccountingReport table was set to null because that table is not 
really a tree. The problem was that the cleaning up of the table was not 
complete, the Is Tree flag should be set to false, and its Tree Table Category 
subtab should be empty. This has been done now.

The Initial Client Setup was failing because of the incomplete cleanup. The 
Tree Table Category of FinancialMgmtAccountingReport had a record called 
Accounting Report, which is the same name as the tree of the 
FinancialMgmtAccountingRptElement table.

details:   https://code.openbravo.com/erp/devel/main/rev/184930b954b1
changeset: 25035:184930b954b1
user:      Augusto Mauch <augusto.mauch <at> openbravo.com>
date:      Mon Oct 20 16:44:30 2014 +0200
summary:   Fixes issue 27912: Time&DateTime fields are properly handled in P&E 
Windows

The values of Time and DateTime fields were not being properly handled, as they 
where not converted from the server timezone offset to UTC before being sent to 
the client. This happened
because the DataToJsonConverter.convertToJsonObjects method did not perform the 
conversion.

Now it does, when possible. For the conversion to be done properly, the 
Property associated with the column value must be passed to the 
convertPrimitiveValue method. This will be done a
s long as the tableId parameter is sent in the datasource request, and as long 
as the property name can be inferred from the column name.

The QueryListDataSource extends ReadOnlyDataSourceService, but the tableId is 
not passed, so this changeset does not fix this case, that will be address in a 
separate issue.

details:   https://code.openbravo.com/erp/devel/main/rev/4d268b0fd185
changeset: 25036:4d268b0fd185
user:      Sandra Huguet <sandra.huguet <at> openbravo.com>
date:      Mon Oct 20 18:23:44 2014 +0200
summary:   Fixed bug 27913 variable updated properly formatted in match 
statement

After fixed issue 27912, variable updated in match statement should formatted as
a date and the conversion to utc should not be performed.

details:   https://code.openbravo.com/erp/devel/main/rev/db47a1de4d86
changeset: 25037:db47a1de4d86
user:      Sandra Huguet <sandra.huguet <at> openbravo.com>
date:      Mon Oct 20 18:39:02 2014 +0200
summary:   Related to issue 27913 Add convertToUTC to obdateutils

details:   https://code.openbravo.com/erp/devel/main/rev/7475281d58f0
changeset: 25038:7475281d58f0
user:      Eduardo Argal Guibert <eduardo.argal <at> openbravo.com>
date:      Thu Oct 23 13:15:37 2014 +0200
summary:   Fixes bug 27913: System throws error message when user try to match 
bank statement lines with OB transactions manually

There was a new method created in OBDateUtils which was asuming parameter date 
was always in the current date. This was wrong so that chnage is reverted and 
method is no longer doing that assumption.

details:   https://code.openbravo.com/erp/devel/main/rev/c2dcefb2b367
changeset: 25039:c2dcefb2b367
user:      Eduardo Argal Guibert <eduardo.argal <at> openbravo.com>
date:      Thu Oct 23 13:37:20 2014 +0200
summary:   Related to issue 27913: Adds comments to method and chnages method 
name

details:   https://code.openbravo.com/erp/devel/main/rev/cc36e94990ef
changeset: 25040:cc36e94990ef
user:      Eduardo Argal Guibert <eduardo.argal <at> openbravo.com>
date:      Thu Oct 23 13:43:11 2014 +0200
summary:   Related to issue 27913. Miossing related files

details:   https://code.openbravo.com/erp/devel/main/rev/d4eb3e2ea286
changeset: 25041:d4eb3e2ea286
user:      Sandra Huguet <sandra.huguet <at> openbravo.com>
date:      Fri Oct 24 09:05:56 2014 +0200
summary:   Related to issue 27913

fix convertDateToUTC method and match statement force name process

details:   https://code.openbravo.com/erp/devel/main/rev/fc7b1540c7d3
changeset: 25042:fc7b1540c7d3
user:      Gorka Ion Damián <gorkaion.damian <at> openbravo.com>
date:      Tue Oct 21 18:48:07 2014 +0200
summary:   Fixed issue 27887.Set required fields as show in grid true.

details:   https://code.openbravo.com/erp/devel/main/rev/0db5096a2393
changeset: 25043:0db5096a2393
user:      Gorka Ion Damián <gorkaion.damian <at> openbravo.com>
date:      Wed Oct 22 10:35:37 2014 +0200
summary:   Related to issue 27887.Implement filtering by Allocated field.

details:   https://code.openbravo.com/erp/devel/main/rev/60a8d9742555
changeset: 25044:60a8d9742555
user:      Gorka Ion Damián <gorkaion.damian <at> openbravo.com>
date:      Wed Oct 22 12:21:54 2014 +0200
summary:   Related to issue 27887.Boolean filters are advanced criterias

When filtering by a boolean in a grid the criteria received by the datasource
is an AdvancedCriteria. New isInScope method created for boolean fields based
on the version for BigDecimals to cope with this type of criterias.

details:   https://code.openbravo.com/erp/devel/main/rev/9e3b3964d9df
changeset: 25045:9e3b3964d9df
user:      Unai Martirena <unai.martirena <at> openbravo.com>
date:      Fri Oct 24 12:32:46 2014 +0200
summary:   Fixes Issue 27970:Add Read Only Logic on Landed Cost tab fields in 
Goods Receipt

Also hide Active field of Landed Cost tab in Goods Receipt window.

details:   https://code.openbravo.com/erp/devel/main/rev/11b2a675415d
changeset: 25046:11b2a675415d
user:      Unai Martirena <unai.martirena <at> openbravo.com>
date:      Fri Oct 24 09:56:21 2014 +0200
summary:   Fixes Issue 27963: Set Unit Cost false in LC Adjustments created in 
Match LC P&E

Also set as currency of this Landed Cost Adjustment lines the currency of the 
Landed Cost header.

diffstat:

 modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_ELEMENT.xml 
                                          |    4 +-
 modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_FIELD.xml   
                                          |    2 +-
 
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/CheckRecordChangedActionHandler.java
 |   16 ++-
 
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/UnMatchTransactionActionHandler.java
 |   16 ++-
 
modules/org.openbravo.advpaymentmngt/web/org.openbravo.advpaymentmngt/js/ob-aprm-matchStatement.js
                       |   10 +-
 
modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/ReadOnlyDataSourceService.java
             |    8 +
 
modules/org.openbravo.service.json/src/org/openbravo/service/json/DataToJsonConverter.java
                               |   26 +++-
 src-db/database/sourcedata/AD_AUXILIARINPUT.xml                                
                                          |   11 +
 src-db/database/sourcedata/AD_COLUMN.xml                                       
                                          |   13 +-
 src-db/database/sourcedata/AD_FIELD.xml                                        
                                          |    6 +-
 src-db/database/sourcedata/AD_TAB.xml                                          
                                          |    1 +
 src-db/database/sourcedata/AD_TABLE.xml                                        
                                          |    6 +-
 src-db/database/sourcedata/AD_TABLE_TREE.xml                                   
                                          |   38 +++---
 
src-util/modulescript/build/classes/org/openbravo/modulescript/UpdateADTrees.class
                                       |    0 
 
src-util/modulescript/build/classes/org/openbravo/modulescript/UpdateADTreesData.class
                                   |    0 
 src-util/modulescript/src/org/openbravo/modulescript/UpdateADTrees.java        
                                          |    4 +
 src-util/modulescript/src/org/openbravo/modulescript/UpdateADTrees_Data.xsql   
                                          |   16 ++
 src/org/openbravo/common/datasource/StockReservationPickAndEditDataSource.java 
                                          |   62 ++++++++-
 src/org/openbravo/costing/LCMatchingProcess.java                               
                                          |    2 +
 src/org/openbravo/erpCommon/ad_forms/DocLCCost.java                            
                                          |    9 +-
 src/org/openbravo/erpCommon/utility/OBDateUtils.java                           
                                          |   18 ++
 21 files changed, 213 insertions(+), 55 deletions(-)

diffs (truncated from 681 to 300 lines):

diff -r 453b81b77af8 -r 11b2a675415d 
modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_ELEMENT.xml
--- 
a/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_ELEMENT.xml
    Fri Oct 24 15:30:26 2014 +0000
+++ 
b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_ELEMENT.xml
    Fri Oct 24 09:56:21 2014 +0200
@@ -1528,8 +1528,8 @@
 <!--F79620AE1CC041308045C23E661BD907-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--F79620AE1CC041308045C23E661BD907-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--F79620AE1CC041308045C23E661BD907-->  
<COLUMNNAME><![CDATA[EM_APRM_MatchTrans_Force]]></COLUMNNAME>
-<!--F79620AE1CC041308045C23E661BD907-->  
<NAME><![CDATA[EM_APRM_MatchTransactions_Force]]></NAME>
-<!--F79620AE1CC041308045C23E661BD907-->  
<PRINTNAME><![CDATA[EM_APRM_MatchTransactions_Force]]></PRINTNAME>
+<!--F79620AE1CC041308045C23E661BD907-->  <NAME><![CDATA[Match Transactions 
Force]]></NAME>
+<!--F79620AE1CC041308045C23E661BD907-->  <PRINTNAME><![CDATA[Match 
Transactions Force]]></PRINTNAME>
 <!--F79620AE1CC041308045C23E661BD907-->  
<AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
 <!--F79620AE1CC041308045C23E661BD907-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
 <!--F79620AE1CC041308045C23E661BD907--></AD_ELEMENT>
diff -r 453b81b77af8 -r 11b2a675415d 
modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_FIELD.xml
--- 
a/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_FIELD.xml  
    Fri Oct 24 15:30:26 2014 +0000
+++ 
b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_FIELD.xml  
    Fri Oct 24 09:56:21 2014 +0200
@@ -17032,7 +17032,7 @@
 <!--B7C06E2CD9EC460FBA493804E274ACC7-->  
<AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
 <!--B7C06E2CD9EC460FBA493804E274ACC7-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--B7C06E2CD9EC460FBA493804E274ACC7-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
-<!--B7C06E2CD9EC460FBA493804E274ACC7-->  
<NAME><![CDATA[EM_APRM_MatchTransactions_Force]]></NAME>
+<!--B7C06E2CD9EC460FBA493804E274ACC7-->  <NAME><![CDATA[Match Transactions 
Force]]></NAME>
 <!--B7C06E2CD9EC460FBA493804E274ACC7-->  
<ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
 <!--B7C06E2CD9EC460FBA493804E274ACC7-->  
<AD_TAB_ID><![CDATA[2845D761A8394468BD3BA4710AA888D4]]></AD_TAB_ID>
 <!--B7C06E2CD9EC460FBA493804E274ACC7-->  
<AD_COLUMN_ID><![CDATA[9DC8500B414640E09BF61A3D14FE13D1]]></AD_COLUMN_ID>
diff -r 453b81b77af8 -r 11b2a675415d 
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/CheckRecordChangedActionHandler.java
--- 
a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/CheckRecordChangedActionHandler.java
  Fri Oct 24 15:30:26 2014 +0000
+++ 
b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/CheckRecordChangedActionHandler.java
  Fri Oct 24 09:56:21 2014 +0200
@@ -19,6 +19,8 @@
 
 package org.openbravo.advpaymentmngt.actionHandler;
 
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
 import java.util.Calendar;
 import java.util.Date;
 import java.util.Map;
@@ -28,8 +30,10 @@
 import org.openbravo.client.kernel.BaseActionHandler;
 import org.openbravo.dal.core.OBContext;
 import org.openbravo.dal.service.OBDal;
+import org.openbravo.erpCommon.utility.OBDateUtils;
 import org.openbravo.erpCommon.utility.OBMessageUtils;
 import org.openbravo.model.financialmgmt.payment.FIN_BankStatementLine;
+import org.openbravo.service.json.JsonUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -44,16 +48,22 @@
       OBContext.setAdminMode(true);
       final JSONObject jsonData = new JSONObject(data);
       final String strBankStatementLineId = 
jsonData.getString("bankStatementLineId");
-      final long updated = jsonData.getLong("updated");
+      String dateStr = jsonData.getString("updated");
+      SimpleDateFormat xmlDateTimeFormat = JsonUtils.createJSTimeFormat();
+      Date date = null;
+      try {
+        date = xmlDateTimeFormat.parse(dateStr);
+      } catch (ParseException e) {
+      }
       final FIN_BankStatementLine bsline = 
OBDal.getInstance().get(FIN_BankStatementLine.class,
           strBankStatementLineId);
       Date bbddBSLUpdated = bsline.getUpdated();
       // Remove milliseconds to compare against updated from UI
       Calendar calendar = Calendar.getInstance();
-      calendar.setTime(bbddBSLUpdated);
+      calendar.setTime(OBDateUtils.convertDateToUTC(bbddBSLUpdated));
       calendar.setLenient(true);
       calendar.set(Calendar.MILLISECOND, 0);
-      if (updated != calendar.getTimeInMillis()) {
+      if (date.getTime() != calendar.getTimeInMillis()) {
         errorMessage = new JSONObject();
         errorMessage.put("severity", "error");
         errorMessage.put("title", "Error");
diff -r 453b81b77af8 -r 11b2a675415d 
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/UnMatchTransactionActionHandler.java
--- 
a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/UnMatchTransactionActionHandler.java
  Fri Oct 24 15:30:26 2014 +0000
+++ 
b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/UnMatchTransactionActionHandler.java
  Fri Oct 24 09:56:21 2014 +0200
@@ -19,6 +19,8 @@
 
 package org.openbravo.advpaymentmngt.actionHandler;
 
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
 import java.util.Calendar;
 import java.util.Date;
 import java.util.Map;
@@ -28,10 +30,12 @@
 import org.openbravo.client.kernel.BaseActionHandler;
 import org.openbravo.dal.core.OBContext;
 import org.openbravo.dal.service.OBDal;
+import org.openbravo.erpCommon.utility.OBDateUtils;
 import org.openbravo.erpCommon.utility.OBMessageUtils;
 import org.openbravo.model.financialmgmt.payment.FIN_BankStatementLine;
 import org.openbravo.model.financialmgmt.payment.FIN_FinaccTransaction;
 import org.openbravo.service.db.DbUtility;
+import org.openbravo.service.json.JsonUtils;
 import org.openbravo.service.json.OBStaleObjectException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -47,16 +51,22 @@
       OBContext.setAdminMode(true);
       final JSONObject jsonData = new JSONObject(data);
       final String strBankStatementLineId = 
jsonData.getString("bankStatementLineId");
-      final long updated = jsonData.getLong("updated");
+      String dateStr = jsonData.getString("updated");
+      SimpleDateFormat xmlDateTimeFormat = JsonUtils.createJSTimeFormat();
+      Date date = null;
+      try {
+        date = xmlDateTimeFormat.parse(dateStr);
+      } catch (ParseException e) {
+      }
       final FIN_BankStatementLine bsline = 
OBDal.getInstance().get(FIN_BankStatementLine.class,
           strBankStatementLineId);
       Date bbddBSLUpdated = bsline.getUpdated();
       // Remove milis
       Calendar calendar = Calendar.getInstance();
-      calendar.setTime(bbddBSLUpdated);
+      calendar.setTime(OBDateUtils.convertDateToUTC(bbddBSLUpdated));
       calendar.setLenient(true);
       calendar.set(Calendar.MILLISECOND, 0);
-      if (updated != calendar.getTimeInMillis()) {
+      if (date.getTime() != calendar.getTimeInMillis()) {
         throw new OBStaleObjectException("@APRM_StaleDate@");
       }
       final FIN_FinaccTransaction transaction = 
bsline.getFinancialAccountTransaction();
diff -r 453b81b77af8 -r 11b2a675415d 
modules/org.openbravo.advpaymentmngt/web/org.openbravo.advpaymentmngt/js/ob-aprm-matchStatement.js
--- 
a/modules/org.openbravo.advpaymentmngt/web/org.openbravo.advpaymentmngt/js/ob-aprm-matchStatement.js
        Fri Oct 24 15:30:26 2014 +0000
+++ 
b/modules/org.openbravo.advpaymentmngt/web/org.openbravo.advpaymentmngt/js/ob-aprm-matchStatement.js
        Fri Oct 24 09:56:21 2014 +0200
@@ -106,8 +106,9 @@
             process, 
             callback, 
             bankStatementLineId = me.record.id, 
-            updated = me.record.bslUpdated.getTime() + 
me.record.bslUpdated.getTimezoneOffset() * 60000,
+            updated = new Date(),
             view = me.grid.view;
+            updated.setTime(me.record.bslUpdated.getTime());
            callback = function (response, data, request) {
              view.onRefreshFunction(view);
              if (data && data.message && data.message.severity === 'error') {
@@ -144,8 +145,9 @@
             process, 
             callback, 
             bankStatementLineId = me.record.id, 
-            updated = me.record.bslUpdated.getTime() + 
me.record.bslUpdated.getTimezoneOffset() * 60000,
+            updated = new Date(),
             view = me.grid.view;
+            updated.setTime(me.record.bslUpdated.getTime());
            callback = function (response, data, request) {
              view.onRefreshFunction(view);
              if (data && data.message && data.message.severity === 'error') {
@@ -175,8 +177,10 @@
       originalPrompt: OB.I18N.getLabel('APRM_MATCHTRANSACTION_DELETE_BUTTON'),
       prompt: OB.I18N.getLabel('APRM_MATCHTRANSACTION_DELETE_BUTTON'),
       action: function () {
-        var callback, bankStatementLineId = me.record.id, updated = 
me.record.bslUpdated.getTime() + me.record.bslUpdated.getTimezoneOffset() * 
60000,
+        var callback, bankStatementLineId = me.record.id, 
+            updated = new Date(),
             view = me.grid.view;
+            updated.setTime(me.record.bslUpdated.getTime());
         callback = function (response, data, request) {
           view.onRefreshFunction(view);
           if (data && data.message && data.message.severity === 'error') {
diff -r 453b81b77af8 -r 11b2a675415d 
modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/ReadOnlyDataSourceService.java
--- 
a/modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/ReadOnlyDataSourceService.java
      Fri Oct 24 15:30:26 2014 +0000
+++ 
b/modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/ReadOnlyDataSourceService.java
      Fri Oct 24 09:56:21 2014 +0200
@@ -28,6 +28,8 @@
 import org.codehaus.jettison.json.JSONException;
 import org.codehaus.jettison.json.JSONObject;
 import org.openbravo.base.exception.OBException;
+import org.openbravo.base.model.Entity;
+import org.openbravo.base.model.ModelProvider;
 import org.openbravo.base.provider.OBProvider;
 import org.openbravo.service.json.DataToJsonConverter;
 import org.openbravo.service.json.DefaultJsonDataService.QueryResultWriter;
@@ -127,10 +129,16 @@
     if (endRowStr != null) {
       endRow = Integer.parseInt(endRowStr);
     }
+    Entity entity = null;
+    final String tableId = parameters.get("tableId");
+    if (tableId != null) {
+      entity = ModelProvider.getInstance().getEntityByTableId(tableId);
+    }
     final List<Map<String, Object>> data = getData(parameters, startRow, 
endRow);
     final DataToJsonConverter toJsonConverter = OBProvider.getInstance().get(
         DataToJsonConverter.class);
     
toJsonConverter.setAdditionalProperties(JsonUtils.getAdditionalProperties(parameters));
+    toJsonConverter.setEntity(entity);
     return toJsonConverter.convertToJsonObjects(data);
   }
 
diff -r 453b81b77af8 -r 11b2a675415d 
modules/org.openbravo.service.json/src/org/openbravo/service/json/DataToJsonConverter.java
--- 
a/modules/org.openbravo.service.json/src/org/openbravo/service/json/DataToJsonConverter.java
        Fri Oct 24 15:30:26 2014 +0000
+++ 
b/modules/org.openbravo.service.json/src/org/openbravo/service/json/DataToJsonConverter.java
        Fri Oct 24 09:56:21 2014 +0200
@@ -82,6 +82,10 @@
   // display property used for table reference fields
   private String displayProperty = null;
 
+  // entity of the data being converted. will be used in the 
convertToJsonObjects, as there are no
+  // BaseOBObjects from which to infer the entity
+  private Entity entity;
+
   private static final Logger log = 
LoggerFactory.getLogger(DataToJsonConverter.class);
 
   /**
@@ -97,12 +101,26 @@
       for (Map<String, Object> dataInstance : data) {
         final JSONObject jsonObject = new JSONObject();
         for (String key : dataInstance.keySet()) {
+          Property property = null;
+          if (this.entity != null) {
+            property = entity.getProperty(key);
+          }
           final Object value = dataInstance.get(key);
           if (value instanceof BaseOBObject) {
             addBaseOBObject(jsonObject, null, key, null, (BaseOBObject) value);
           } else {
-            // TODO: format!
-            jsonObject.put(key, convertPrimitiveValue(value));
+            Object convertedValue = null;
+            if (value != null && property != null && property.isPrimitive()) {
+              // if the property is known and the value is not null, use the
+              // convertPrimitiveValue(property, value) method to convert the 
value. It is more
+              // complete than convertPrimitiveValue(value) as the former 
converts dates from the
+              // server timezone offset to UTC, among other things
+              convertedValue = convertPrimitiveValue(property, value);
+            } else {
+              // TODO: format!
+              convertedValue = convertPrimitiveValue(value);
+            }
+            jsonObject.put(key, convertedValue);
           }
         }
         jsonObjects.add(jsonObject);
@@ -425,4 +443,8 @@
   public void setDisplayProperty(String displayPropertyValue) {
     displayProperty = displayPropertyValue;
   }
+
+  public void setEntity(Entity entity) {
+    this.entity = entity;
+  }
 }
diff -r 453b81b77af8 -r 11b2a675415d 
src-db/database/sourcedata/AD_AUXILIARINPUT.xml
--- a/src-db/database/sourcedata/AD_AUXILIARINPUT.xml   Fri Oct 24 15:30:26 
2014 +0000
+++ b/src-db/database/sourcedata/AD_AUXILIARINPUT.xml   Fri Oct 24 09:56:21 
2014 +0200
@@ -3411,6 +3411,17 @@
 <!--D030CCF0F7514C898D981791049FB0DF-->  
<AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--D030CCF0F7514C898D981791049FB0DF--></AD_AUXILIARINPUT>
 
+<!--D0A19017CE354E62883A1404058DA667--><AD_AUXILIARINPUT>
+<!--D0A19017CE354E62883A1404058DA667-->  
<AD_AUXILIARINPUT_ID><![CDATA[D0A19017CE354E62883A1404058DA667]]></AD_AUXILIARINPUT_ID>
+<!--D0A19017CE354E62883A1404058DA667-->  
<AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--D0A19017CE354E62883A1404058DA667-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--D0A19017CE354E62883A1404058DA667-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--D0A19017CE354E62883A1404058DA667-->  
<AD_TAB_ID><![CDATA[0F76B56EB2874C729ABE1665D5853E9D]]></AD_TAB_ID>
+<!--D0A19017CE354E62883A1404058DA667-->  <NAME><![CDATA[HeaderStatus]]></NAME>
+<!--D0A19017CE354E62883A1404058DA667-->  <CODE><![CDATA[@SQL=SELECT DOCSTATUS 
FROM M_INOUT WHERE M_INOUT_ID = @M_INOUT_ID@]]></CODE>
+<!--D0A19017CE354E62883A1404058DA667-->  
<AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--D0A19017CE354E62883A1404058DA667--></AD_AUXILIARINPUT>
+
 <!--D0DC4F3EC11B4F6D9457EF08B5AF54C5--><AD_AUXILIARINPUT>
 <!--D0DC4F3EC11B4F6D9457EF08B5AF54C5-->  
<AD_AUXILIARINPUT_ID><![CDATA[D0DC4F3EC11B4F6D9457EF08B5AF54C5]]></AD_AUXILIARINPUT_ID>
 <!--D0DC4F3EC11B4F6D9457EF08B5AF54C5-->  
<AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
diff -r 453b81b77af8 -r 11b2a675415d src-db/database/sourcedata/AD_COLUMN.xml
--- a/src-db/database/sourcedata/AD_COLUMN.xml  Fri Oct 24 15:30:26 2014 +0000
+++ b/src-db/database/sourcedata/AD_COLUMN.xml  Fri Oct 24 09:56:21 2014 +0200
@@ -221688,6 +221688,7 @@
 <!--00568254CB678733E050007F01000513-->  <ISPARENT><![CDATA[Y]]></ISPARENT>
 <!--00568254CB678733E050007F01000513-->  
<ISMANDATORY><![CDATA[N]]></ISMANDATORY>
 <!--00568254CB678733E050007F01000513-->  
<ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
+<!--00568254CB678733E050007F01000513-->  
<READONLYLOGIC><![CDATA[@HeaderStatus@='CO']]></READONLYLOGIC>
 <!--00568254CB678733E050007F01000513-->  
<ISIDENTIFIER><![CDATA[Y]]></ISIDENTIFIER>
 <!--00568254CB678733E050007F01000513-->  <SEQNO><![CDATA[90]]></SEQNO>
 <!--00568254CB678733E050007F01000513-->  
<ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
@@ -221758,7 +221759,7 @@
 <!--00568254CB698733E050007F01000513-->  <ISPARENT><![CDATA[N]]></ISPARENT>
 <!--00568254CB698733E050007F01000513-->  
<ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
 <!--00568254CB698733E050007F01000513-->  
<ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
-<!--00568254CB698733E050007F01000513-->  
<READONLYLOGIC><![CDATA[@ProcessedHeader@='Y']]></READONLYLOGIC>
+<!--00568254CB698733E050007F01000513-->  
<READONLYLOGIC><![CDATA[@ProcessedHeader@='Y' | 
@HeaderStatus@='CO']]></READONLYLOGIC>
 <!--00568254CB698733E050007F01000513-->  
<ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
 <!--00568254CB698733E050007F01000513-->  <SEQNO><![CDATA[110]]></SEQNO>
 <!--00568254CB698733E050007F01000513-->  
<ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
@@ -221792,7 +221793,7 @@
 <!--00568254CB6B8733E050007F01000513-->  <ISPARENT><![CDATA[N]]></ISPARENT>
 <!--00568254CB6B8733E050007F01000513-->  
<ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
 <!--00568254CB6B8733E050007F01000513-->  
<ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
-<!--00568254CB6B8733E050007F01000513-->  
<READONLYLOGIC><![CDATA[@ProcessedHeader@='Y'|(@c_invoiceline_id@!null&@c_invoiceline_id@!'')]]></READONLYLOGIC>
+<!--00568254CB6B8733E050007F01000513-->  
<READONLYLOGIC><![CDATA[@ProcessedHeader@='Y'|(@c_invoiceline_id@!null&@c_invoiceline_id@!'')
 | @HeaderStatus@='CO']]></READONLYLOGIC>
 <!--00568254CB6B8733E050007F01000513-->  
<ISIDENTIFIER><![CDATA[Y]]></ISIDENTIFIER>
 <!--00568254CB6B8733E050007F01000513-->  <SEQNO><![CDATA[130]]></SEQNO>
 <!--00568254CB6B8733E050007F01000513-->  
<ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
@@ -221828,7 +221829,7 @@
 <!--00568254CB6C8733E050007F01000513-->  <ISPARENT><![CDATA[N]]></ISPARENT>
 <!--00568254CB6C8733E050007F01000513-->  
<ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
 <!--00568254CB6C8733E050007F01000513-->  
<ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
-<!--00568254CB6C8733E050007F01000513-->  
<READONLYLOGIC><![CDATA[@ProcessedHeader@='Y']]></READONLYLOGIC>
+<!--00568254CB6C8733E050007F01000513-->  
<READONLYLOGIC><![CDATA[@ProcessedHeader@='Y' | 
@HeaderStatus@='CO']]></READONLYLOGIC>

------------------------------------------------------------------------------
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to