details:   https://code.openbravo.com/erp/devel/pi/rev/3d7237675ba2
changeset: 35713:3d7237675ba2
user:      Carlos Aristu <carlos.aristu <at> openbravo.com>
date:      Mon May 06 09:33:11 2019 +0200
summary:   fixes issue 40743: wrong export to CSV having the grid filtered by a 
date time

  After the following changeset[1], exporting the grid to CSV was not working 
properly having the grid filtered by a date time column. Although the fix is 
correct, it caused the criteria sent to the datasource in this type of requests 
to stop being handled properly.

  To avoid this problem, when exporting to CSV a grid filtered by a date time 
column we send in the criteria the plain date (in the same way as it is being 
done for the standard grid DS requests) and the datasource will take care of 
building the date filter properly through the AdvancedQueryBuilder.

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-grid.js
 |  8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diffs (25 lines):

diff -r a09be04c90d7 -r 3d7237675ba2 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-grid.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-grid.js
  Fri May 03 09:54:13 2019 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-grid.js
  Mon May 06 09:33:11 2019 +0200
@@ -1242,6 +1242,7 @@
       _textMatchStyle: 'substring',
       _UTCOffsetMiliseconds: OB.Utilities.Date.getUTCOffsetInMiliseconds()
     }, lcriteria, this.getFetchRequestParams(null, isExporting));
+
     sortCriteria = this.getSort();
     if (sortCriteria && sortCriteria.length > 0) {
       d._sortBy = sortCriteria[0].property;
@@ -1249,6 +1250,13 @@
         d._sortBy = '-' + d._sortBy;
       }
     }
+
+    if (d.criteria) {
+      // Encode the grid criteria as it is done for the standard grid requests
+      // Note that OB.Utilities.postThroughHiddenForm has its own logic for 
encoding dates
+      d.criteria = isc.JSON.encode(d.criteria);
+    }
+
     OB.Utilities.postThroughHiddenForm(dsURL, d);
   },
 


_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to