Fixed issue 15092 Change OrganizationComboData instead of ComboTableData
authorSandra Huguet <sandra.huguet@openbravo.com>
Tue, 24 Apr 2012 12:44:32 +0200
changeset 16195 2580ff5d8c68
parent 16194 8f215938f06a
child 16196 b1c45effac4b
Fixed issue 15092 Change OrganizationComboData instead of ComboTableData
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_forms/BatchPaymentExecution.java
modules/org.openbravo.reports.ordersawaitingdelivery/src/org/openbravo/reports/ordersawaitingdelivery/erpCommon/ad_reports/ReportOrderNotShipped.java
src/org/openbravo/erpCommon/ad_combos/OrganizationCombo_data.xsql
src/org/openbravo/erpCommon/ad_process/PrintInvoices.java
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_forms/BatchPaymentExecution.java	Tue Apr 24 17:06:29 2012 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_forms/BatchPaymentExecution.java	Tue Apr 24 12:44:32 2012 +0200
@@ -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-2011 Openbravo SLU
+ * All portions are Copyright (C) 2010-2012 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  *************************************************************************
@@ -39,10 +39,9 @@
 import org.openbravo.dal.core.OBContext;
 import org.openbravo.dal.service.OBCriteria;
 import org.openbravo.dal.service.OBDal;
-import org.openbravo.data.FieldProvider;
-import org.openbravo.erpCommon.ad_combos.OrganizationComboData;
 import org.openbravo.erpCommon.businessUtility.WindowTabs;
 import org.openbravo.erpCommon.info.SelectorUtility;
+import org.openbravo.erpCommon.utility.ComboTableData;
 import org.openbravo.erpCommon.utility.DateTimeData;
 import org.openbravo.erpCommon.utility.LeftTabsBar;
 import org.openbravo.erpCommon.utility.NavigationBar;
@@ -149,16 +148,21 @@
     xmlDocument.setParameter("inpChkIsReceipt", strIsReceipt);
 
     String newOrg = strOrganizationId;
-    if (!"0".equals(strOrganizationId)) {
+    if (null != (strOrganizationId)) {
       xmlDocument.setParameter("orgId", strOrganizationId);
-    } else {
-      FieldProvider[] fp = OrganizationComboData.selectCombo(this, vars.getRole());
-      if (fp != null && fp.length > 0) {
-        newOrg = fp[0].getField("id");
-      }
     }
-    xmlDocument.setData("reportAD_ORGID", "liststructure",
-        OrganizationComboData.selectCombo(this, vars.getRole()));
+    try {
+      ComboTableData comboTableData = new ComboTableData(vars, this, "TABLEDIR", "AD_Org_ID", "",
+          "", Utility.getContext(this, vars, "#User_Org", "BatchPaymentExecution"),
+          Utility.getContext(this, vars, "#User_Client", "BatchPaymentExecution"), 0);
+      Utility.fillSQLParameters(this, vars, null, comboTableData, "PrintInvoices", "");
+      xmlDocument.setData("reportAD_ORGID", "liststructure", comboTableData.select(false));
+      comboTableData = null;
+
+    } catch (Exception ex) {
+      throw new ServletException(ex);
+    }
+
     xmlDocument.setParameter("dateFrom", strDateFrom);
     xmlDocument.setParameter("dateTo", strDateTo);
 
--- a/modules/org.openbravo.reports.ordersawaitingdelivery/src/org/openbravo/reports/ordersawaitingdelivery/erpCommon/ad_reports/ReportOrderNotShipped.java	Tue Apr 24 17:06:29 2012 +0200
+++ b/modules/org.openbravo.reports.ordersawaitingdelivery/src/org/openbravo/reports/ordersawaitingdelivery/erpCommon/ad_reports/ReportOrderNotShipped.java	Tue Apr 24 12:44:32 2012 +0200
@@ -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-2011 Openbravo SLU 
+ * All portions are Copyright (C) 2009-2012 Openbravo SLU 
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -28,7 +28,6 @@
 
 import org.openbravo.base.secureApp.HttpSecureAppServlet;
 import org.openbravo.base.secureApp.VariablesSecureApp;
-import org.openbravo.erpCommon.ad_combos.OrganizationComboData;
 import org.openbravo.erpCommon.businessUtility.WindowTabs;
 import org.openbravo.erpCommon.utility.ComboTableData;
 import org.openbravo.erpCommon.utility.DateTimeData;
@@ -153,8 +152,17 @@
     xmlDocument.setParameter("orderDocNo", strOrderDocNo);
     xmlDocument.setParameter("orderRef", strOrderRef);
     xmlDocument.setParameter("adOrgId", strCOrgId);
-    xmlDocument.setData("reportAD_ORGID", "liststructure",
-        OrganizationComboData.selectCombo(this, vars.getRole()));
+    try {
+      ComboTableData comboTableData = new ComboTableData(vars, this, "TABLEDIR", "AD_Org_ID", "",
+          "", Utility.getContext(this, vars, "#AccessibleOrgTree", "PrintInvoices"),
+          Utility.getContext(this, vars, "#User_Client", "ReportOrderNotShipped"), 0);
+      Utility.fillSQLParameters(this, vars, null, comboTableData, "ReportOrderNotShipped", "");
+      xmlDocument.setData("reportAD_ORGID", "liststructure", comboTableData.select(false));
+      comboTableData = null;
+
+    } catch (Exception ex) {
+      throw new ServletException(ex);
+    }
     response.setContentType("text/html; charset=UTF-8");
     PrintWriter out = response.getWriter();
     out.println(xmlDocument.print());
--- a/src/org/openbravo/erpCommon/ad_combos/OrganizationCombo_data.xsql	Tue Apr 24 17:06:29 2012 +0200
+++ b/src/org/openbravo/erpCommon/ad_combos/OrganizationCombo_data.xsql	Tue Apr 24 12:44:32 2012 +0200
@@ -23,9 +23,9 @@
 
 
 <SqlClass name="OrganizationComboData" package="org.openbravo.erpCommon.ad_combos" accessModifier="public">
-   <SqlClassComment></SqlClassComment>
+   <SqlClassComment>This class is obsolete, you should use org.openbravo.erpCommon.utility.ComboTableData</SqlClassComment>
    <SqlMethod name="select" type="preparedStatement" return="multiple">
-      <SqlMethodComment></SqlMethodComment>
+      <SqlMethodComment>deprecated</SqlMethodComment>
       <Sql><![CDATA[
         SELECT A_O.AD_ORG_ID, A_O.NAME, '' AS ID 
         FROM AD_ORG A_O, AD_ROLE_ORGACCESS A_R_O, AD_ROLE R 
@@ -40,7 +40,7 @@
         <Parameter name="rol"/>
    </SqlMethod>
    <SqlMethod name="selectCombo" type="preparedStatement" return="multiple">
-      <SqlMethodComment></SqlMethodComment>
+      <SqlMethodComment>deprecated</SqlMethodComment>
       <Sql><![CDATA[
         SELECT A_O.AD_ORG_ID AS ID, A_O.NAME 
         FROM AD_ORG A_O, AD_ROLE_ORGACCESS A_R_O, AD_ROLE R 
@@ -56,7 +56,7 @@
    </SqlMethod>
 
    <SqlMethod name="isRoleOrg" type="preparedStatement" return="Boolean" default="false">
-      <SqlMethodComment></SqlMethodComment>
+      <SqlMethodComment>deprecated</SqlMethodComment>
       <Sql><![CDATA[
         SELECT COUNT(*) AS TOTAL 
         FROM AD_ROLE_ORGACCESS A_R_O, AD_ROLE R 
--- a/src/org/openbravo/erpCommon/ad_process/PrintInvoices.java	Tue Apr 24 17:06:29 2012 +0200
+++ b/src/org/openbravo/erpCommon/ad_process/PrintInvoices.java	Tue Apr 24 12:44:32 2012 +0200
@@ -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) 2001-2010 Openbravo SLU 
+ * All portions are Copyright (C) 2001-2012 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -29,12 +29,13 @@
 import org.openbravo.base.secureApp.HttpSecureAppServlet;
 import org.openbravo.base.secureApp.VariablesSecureApp;
 import org.openbravo.erpCommon.ad_actionButton.ActionButtonDefaultData;
-import org.openbravo.erpCommon.ad_combos.OrganizationComboData;
 import org.openbravo.erpCommon.businessUtility.WindowTabs;
+import org.openbravo.erpCommon.utility.ComboTableData;
 import org.openbravo.erpCommon.utility.LeftTabsBar;
 import org.openbravo.erpCommon.utility.NavigationBar;
 import org.openbravo.erpCommon.utility.OBError;
 import org.openbravo.erpCommon.utility.ToolBar;
+import org.openbravo.erpCommon.utility.Utility;
 import org.openbravo.xmlEngine.XmlDocument;
 
 public class PrintInvoices extends HttpSecureAppServlet {
@@ -79,8 +80,18 @@
     xmlDocument.setParameter("calendar", vars.getLanguage().substring(0, 2));
     xmlDocument.setParameter("directory", "var baseDirectory = \"" + strReplaceWith + "/\";\n");
     xmlDocument.setParameter("paramLanguage", "defaultLang=\"" + vars.getLanguage() + "\";");
-    xmlDocument.setData("reportAD_ORGID", "liststructure",
-        OrganizationComboData.selectCombo(this, vars.getRole()));
+
+    try {
+      ComboTableData comboTableData = new ComboTableData(vars, this, "TABLEDIR", "AD_Org_ID", "",
+          "", Utility.getContext(this, vars, "#AccessibleOrgTree", "PrintInvoices"),
+          Utility.getContext(this, vars, "#User_Client", "PrintInvoices"), 0);
+      Utility.fillSQLParameters(this, vars, null, comboTableData, "PrintInvoices", "");
+      xmlDocument.setData("reportAD_ORGID", "liststructure", comboTableData.select(false));
+      comboTableData = null;
+
+    } catch (Exception ex) {
+      throw new ServletException(ex);
+    }
 
     xmlDocument.setParameter("dateFromdisplayFormat", vars.getSessionValue("#AD_SqlDateFormat"));
     xmlDocument.setParameter("dateFromsaveFormat", vars.getSessionValue("#AD_SqlDateFormat"));