details:   /erp/devel/pi/rev/89b11e5682fb
changeset: 13103:89b11e5682fb
user:      Antonio Moreno <antonio.moreno <at> openbravo.com>
date:      Tue Jul 05 15:48:42 2011 +0200
summary:   Related to issue 17789.
Added window information to preference retrieval to avoid problems in case the 
user defines the preference linked to a particular window

diffstat:

 
modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/DataSourceServlet.java
 |  12 +++++++--
 1 files changed, 9 insertions(+), 3 deletions(-)

diffs (50 lines):

diff -r 8a3f82b01a3e -r 89b11e5682fb 
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
      Tue Jul 05 14:03:51 2011 +0200
+++ 
b/modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/DataSourceServlet.java
      Tue Jul 05 15:48:42 2011 +0200
@@ -71,6 +71,7 @@
 import org.openbravo.model.ad.ui.Field;
 import org.openbravo.model.ad.ui.FieldTrl;
 import org.openbravo.model.ad.ui.Tab;
+import org.openbravo.model.ad.ui.Window;
 import org.openbravo.service.json.DefaultJsonDataService;
 import org.openbravo.service.json.JsonConstants;
 import org.openbravo.service.json.JsonUtils;
@@ -195,10 +196,13 @@
         }
         if ("csv".equals(exportAs)) {
           try {
+            Window window = parameters.get("tab") == null
+                || parameters.get("tab").equals("undefined") ? null : 
OBDal.getInstance()
+                .get(Tab.class, parameters.get("tab")).getWindow();
             String encoding = 
Preferences.getPreferenceValue("OBSERDS_CSVTextEncoding", true,
                 OBContext.getOBContext().getCurrentClient(), 
OBContext.getOBContext()
                     .getCurrentOrganization(), 
OBContext.getOBContext().getUser(), OBContext
-                    .getOBContext().getRole(), null);
+                    .getOBContext().getRole(), window);
             response.setContentType("text/csv; charset=" + encoding);
           } catch (PropertyNotFoundException e) {
             // There is no preference for encoding, using standard one which 
works on Excel
@@ -254,11 +258,13 @@
         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();
         try {
           prefDecimalSeparator = 
Preferences.getPreferenceValue("OBSERDS_CSVDecimalSeparator",
               true, OBContext.getOBContext().getCurrentClient(), 
OBContext.getOBContext()
                   .getCurrentOrganization(), 
OBContext.getOBContext().getUser(), OBContext
-                  .getOBContext().getRole(), null);
+                  .getOBContext().getRole(), window);
         } catch (PropertyNotFoundException e) {
           // There is no preference for the decimal separator.
         }
@@ -268,7 +274,7 @@
           fieldSeparator = 
Preferences.getPreferenceValue("OBSERDS_CSVFieldSeparator", true,
               OBContext.getOBContext().getCurrentClient(), 
OBContext.getOBContext()
                   .getCurrentOrganization(), 
OBContext.getOBContext().getUser(), OBContext
-                  .getOBContext().getRole(), null);
+                  .getOBContext().getRole(), window);
         } catch (PropertyNotFoundException e) {
           // There is no preference for the field separator. Using the default 
one.
           fieldSeparator = ",";

------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to