details:   https://code.openbravo.com/erp/devel/pi/rev/8c53c9e9c26f
changeset: 28687:8c53c9e9c26f
user:      Inigo Sanchez <inigo.sanchez <at> openbravo.com>
date:      Mon Feb 29 23:49:20 2016 +0100
summary:   Fixes issue 32233: Payment In and Payment Out lines are not exported 
to CSV.

The problem was that export to CSV does not work properly in some subtabs 
without
link to parent column (e.g.Lines subtab of Payment In/Out). Before, It was used
"tabId" to obtaing data for  export to CSV and the value of the "tabId" was sent
in a variable called "tab". The Criteria that is run when it is displayed the 
tab
uses a property named "tabId" instead of "tab".

The solution for this case (and other related cases) is to adapt the code that
exports to CSV to use the same Criteria run when displaying the tab. Now export
to CSV uses tabId property. Besides it has been refactored some piece of code
related with export data in DataSourceServlet to use "tabId" instead of "tab".

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-grid.js
     |   4 +-
 
modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/DataSourceServlet.java
 |  27 +++++----
 2 files changed, 18 insertions(+), 13 deletions(-)

diffs (86 lines):

diff -r 6f297f8de5d6 -r 8c53c9e9c26f 
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
  Thu Feb 18 13:23:15 2016 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-grid.js
  Mon Feb 29 23:49:20 2016 +0100
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2010-2015 Openbravo SLU
+ * All portions are Copyright (C) 2010-2016 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -1071,7 +1071,7 @@
       exportAs: expProp.exportAs || 'csv',
       viewState: expProp.viewState,
       _extraProperties: expProp._extraProperties,
-      tab: expProp.tab,
+      tabId: expProp.tab,
       exportToFile: true,
       _textMatchStyle: 'substring',
       _UTCOffsetMiliseconds: OB.Utilities.Date.getUTCOffsetInMiliseconds()
diff -r 6f297f8de5d6 -r 8c53c9e9c26f 
modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/DataSourceServlet.java
--- 
a/modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/DataSourceServlet.java
      Thu Feb 18 13:23:15 2016 +0100
+++ 
b/modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/DataSourceServlet.java
      Mon Feb 29 23:49:20 2016 +0100
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2009-2015 Openbravo SLU
+ * All portions are Copyright (C) 2009-2016 Openbravo SLU
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -226,9 +226,10 @@
           try {
             OBContext.setAdminMode();
             try {
-              Window window = parameters.get("tab") == null
-                  || parameters.get("tab").equals("undefined") ? null : 
OBDal.getInstance()
-                  .get(Tab.class, parameters.get("tab")).getWindow();
+              Window window = parameters.get(JsonConstants.TAB_PARAMETER) == 
null
+                  || 
parameters.get(JsonConstants.TAB_PARAMETER).equals("undefined") ? null : OBDal
+                  .getInstance().get(Tab.class, 
parameters.get(JsonConstants.TAB_PARAMETER))
+                  .getWindow();
               String encoding = 
Preferences.getPreferenceValue("OBSERDS_CSVTextEncoding", true,
                   OBContext.getOBContext().getCurrentClient(), 
OBContext.getOBContext()
                       .getCurrentOrganization(), 
OBContext.getOBContext().getUser(), OBContext
@@ -299,8 +300,9 @@
         response.setHeader("Content-Disposition", "attachment; 
filename=ExportedData.csv");
         writer = response.getWriter();
         VariablesSecureApp vars = new VariablesSecureApp(request);
-        Window window = parameters.get("tab") == null || 
parameters.get("tab").equals("undefined") ? null
-            : OBDal.getInstance().get(Tab.class, 
parameters.get("tab")).getWindow();
+        Window window = parameters.get(JsonConstants.TAB_PARAMETER) == null
+            || parameters.get(JsonConstants.TAB_PARAMETER).equals("undefined") 
? null : OBDal
+            .getInstance().get(Tab.class, 
parameters.get(JsonConstants.TAB_PARAMETER)).getWindow();
         try {
           prefDecimalSeparator = 
Preferences.getPreferenceValue("OBSERDS_CSVDecimalSeparator",
               true, OBContext.getOBContext().getCurrentClient(), 
OBContext.getOBContext()
@@ -414,8 +416,10 @@
               } else {
                 niceFieldProperties.put(propKey, col.getName());
               }
-            } else if (parameters.get("tab") != null && 
!parameters.get("tab").equals("")) {
-              Tab tab = OBDal.getInstance().get(Tab.class, 
parameters.get("tab"));
+            } else if (parameters.get(JsonConstants.TAB_PARAMETER) != null
+                && !parameters.get(JsonConstants.TAB_PARAMETER).equals("")) {
+              Tab tab = OBDal.getInstance().get(Tab.class,
+                  parameters.get(JsonConstants.TAB_PARAMETER));
               for (Field field : tab.getADFieldList()) {
                 if (field.getColumn() == null || 
!field.getColumn().getId().equals(col.getId())) {
                   continue;
@@ -685,9 +689,10 @@
       try {
         String csvMessage = null;
         try {
-          Window window = parameters.get("tab") == null
-              || parameters.get("tab").equals("undefined") ? null : 
OBDal.getInstance()
-              .get(Tab.class, parameters.get("tab")).getWindow();
+          Window window = parameters.get(JsonConstants.TAB_PARAMETER) == null
+              || 
parameters.get(JsonConstants.TAB_PARAMETER).equals("undefined") ? null : OBDal
+              .getInstance().get(Tab.class, 
parameters.get(JsonConstants.TAB_PARAMETER))
+              .getWindow();
           csvMessage = Preferences.getPreferenceValue(property, true, 
OBContext.getOBContext()
               .getCurrentClient(), 
OBContext.getOBContext().getCurrentOrganization(), OBContext
               .getOBContext().getUser(), OBContext.getOBContext().getRole(), 
window);

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to