Fixed issue 27953 AccessibleOrgTree wrongly used in some reports
authorJorge Garcia <jorge.garcia@openbravo.com>
Tue, 17 Feb 2015 12:33:34 +0100
changeset 26169 e5cd53fc8141
parent 26168 59a302602f2f
child 26170 9e165ce2e311
Fixed issue 27953 AccessibleOrgTree wrongly used in some reports

In many manual reports the organization combo is filled using:

ComboTableData comboTableData = new ComboTableData(vars, this,
"TABLEDIR", "AD_ORG_ID", "", "", Utility.getContext(this, vars,
"#AccessibleOrgTree", "XXXX"), Utility.getContext(this, vars,
"#User_Client", "XXXX"), '*');

“#AccessibleOrgTree” context gets the list of all the granted organizations,
their ancestors and their descendants organizations. It's necessary to use
“#User_Org” instead, which contains the organizations that are granted
by the role:

ComboTableData comboTableData = new ComboTableData(vars, this,
"TABLEDIR", "AD_ORG_ID", "", "", Utility.getContext(this, vars,
"#User_Org", "XXXX"), Utility.getContext(this, vars,
"#User_Client", "XXXX"), '*');

Reports from these folders had been checked:
src/org/openbravo/erpCommon/ad_reports
src/org/openbravo/erpReports

Files affected by this issue had been changed and tried
modules/org.openbravo.reports.ordersawaitingdelivery/src/org/openbravo/reports/ordersawaitingdelivery/erpCommon/ad_reports/ReportOrderNotShipped.java
src/org/openbravo/erpCommon/ad_reports/ReportAgingBalance.java
src/org/openbravo/erpCommon/ad_reports/ReportAnnualCertification.java
src/org/openbravo/erpCommon/ad_reports/ReportAssetDepreciationSchedule.java
src/org/openbravo/erpCommon/ad_reports/ReportBudgetGenerateExcel.java
src/org/openbravo/erpCommon/ad_reports/ReportCashFlow.java
src/org/openbravo/erpCommon/ad_reports/ReportInvoiceCustomerDimensionalAnalysesJR.java
src/org/openbravo/erpCommon/ad_reports/ReportMaterialDimensionalAnalysesJR.java
src/org/openbravo/erpCommon/ad_reports/ReportOrderNotInvoiceJR.java
src/org/openbravo/erpCommon/ad_reports/ReportParetoProduct.java
src/org/openbravo/erpCommon/ad_reports/ReportProjectProfitabilityJR.java
src/org/openbravo/erpCommon/ad_reports/ReportRefundSalesDimensionalAnalyses.java
src/org/openbravo/erpCommon/ad_reports/ReportShipmentDimensionalAnalyzeJR.java
src/org/openbravo/erpCommon/ad_reports/ReportTaxInvoiceJR.java
--- a/modules/org.openbravo.reports.ordersawaitingdelivery/src/org/openbravo/reports/ordersawaitingdelivery/erpCommon/ad_reports/ReportOrderNotShipped.java	Thu Mar 12 12:00:30 2015 +0100
+++ b/modules/org.openbravo.reports.ordersawaitingdelivery/src/org/openbravo/reports/ordersawaitingdelivery/erpCommon/ad_reports/ReportOrderNotShipped.java	Tue Feb 17 12:33:34 2015 +0100
@@ -154,7 +154,7 @@
     xmlDocument.setParameter("adOrgId", strCOrgId);
     try {
       ComboTableData comboTableData = new ComboTableData(vars, this, "TABLEDIR", "AD_Org_ID", "",
-          "49DC1D6F086945AB82F84C66F5F13F16", Utility.getContext(this, vars, "#AccessibleOrgTree",
+          "49DC1D6F086945AB82F84C66F5F13F16", Utility.getContext(this, vars, "#User_Org",
               "ReportOrderNotShipped"), Utility.getContext(this, vars, "#User_Client",
               "ReportOrderNotShipped"), 0);
       Utility.fillSQLParameters(this, vars, null, comboTableData, "ReportOrderNotShipped", "");
--- a/src/org/openbravo/erpCommon/ad_reports/ReportAgingBalance.java	Thu Mar 12 12:00:30 2015 +0100
+++ b/src/org/openbravo/erpCommon/ad_reports/ReportAgingBalance.java	Tue Feb 17 12:33:34 2015 +0100
@@ -236,7 +236,7 @@
     xmlDocument.setParameter("paramAD_ORG_Id", strOrgTrx);
     try {
       ComboTableData comboTableData = new ComboTableData(vars, this, "TABLEDIR", "AD_ORG_ID", "",
-          "", Utility.getContext(this, vars, "#AccessibleOrgTree", "ReportAgingBalanceData"),
+          "", Utility.getContext(this, vars, "#User_Org", "ReportAgingBalanceData"),
           Utility.getContext(this, vars, "#User_Client", "ReportAgingBalanceData"), '*');
       comboTableData.fillParameters(null, "ReportAgingBalanceData", strOrgTrx);
       xmlDocument.setData("reportAD_ORGID", "liststructure", comboTableData.select(false));
--- a/src/org/openbravo/erpCommon/ad_reports/ReportAnnualCertification.java	Thu Mar 12 12:00:30 2015 +0100
+++ b/src/org/openbravo/erpCommon/ad_reports/ReportAnnualCertification.java	Tue Feb 17 12:33:34 2015 +0100
@@ -243,7 +243,7 @@
     try {
       // AD_OrgType_BU_LE
       ComboTableData comboTableData = new ComboTableData(vars, this, "TABLEDIR", "AD_ORG_ID", "",
-          "AD_OrgType_BU_LE", Utility.getContext(this, vars, "#AccessibleOrgTree",
+          "AD_OrgType_BU_LE", Utility.getContext(this, vars, "#User_Org",
               "ReportAnnualCertification"), Utility.getContext(this, vars, "#User_Client",
               "ReportAnnualCertification"), '*');
       comboTableData.fillParameters(null, "ReportAnnualCertification", "");
--- a/src/org/openbravo/erpCommon/ad_reports/ReportAssetDepreciationSchedule.java	Thu Mar 12 12:00:30 2015 +0100
+++ b/src/org/openbravo/erpCommon/ad_reports/ReportAssetDepreciationSchedule.java	Tue Feb 17 12:33:34 2015 +0100
@@ -185,9 +185,8 @@
 
     try {
       ComboTableData comboTableData = new ComboTableData(vars, this, "TABLEDIR", "AD_ORG_ID", "",
-          "", Utility.getContext(this, vars, "#AccessibleOrgTree",
-              "ReportAssetDepreciationSchedule"), Utility.getContext(this, vars, "#User_Client",
-              "ReportAssetDepreciationSchedule"), '*');
+          "", Utility.getContext(this, vars, "#User_Org", "ReportAssetDepreciationSchedule"),
+          Utility.getContext(this, vars, "#User_Client", "ReportAssetDepreciationSchedule"), '*');
       comboTableData.fillParameters(null, "ReportAssetDepreciationSchedule", "");
       xmlDocument.setData("reportAD_ORG_ID", "liststructure", comboTableData.select(false));
     } catch (Exception ex) {
--- a/src/org/openbravo/erpCommon/ad_reports/ReportBudgetGenerateExcel.java	Thu Mar 12 12:00:30 2015 +0100
+++ b/src/org/openbravo/erpCommon/ad_reports/ReportBudgetGenerateExcel.java	Tue Feb 17 12:33:34 2015 +0100
@@ -255,7 +255,7 @@
 
     try {
       ComboTableData comboTableData = new ComboTableData(vars, this, "TABLEDIR", "AD_Org_ID", "",
-          "", Utility.getContext(this, vars, "#AccessibleOrgTree", "ReportBudgetGenerateExcel"),
+          "", Utility.getContext(this, vars, "#User_Org", "ReportBudgetGenerateExcel"),
           Utility.getContext(this, vars, "#User_Client", "ReportBudgetGenerateExcel"), 0);
       Utility.fillSQLParameters(this, vars, null, comboTableData, "ReportBudgetGenerateExcel", "");
       xmlDocument.setData("reportTrxOrg", "liststructure", comboTableData.select(false));
--- a/src/org/openbravo/erpCommon/ad_reports/ReportCashFlow.java	Thu Mar 12 12:00:30 2015 +0100
+++ b/src/org/openbravo/erpCommon/ad_reports/ReportCashFlow.java	Tue Feb 17 12:33:34 2015 +0100
@@ -126,8 +126,7 @@
 
     try {
       ComboTableData comboTableData = new ComboTableData(vars, this, "TABLEDIR", "AD_Org_ID", "",
-          "AD_OrgType_BU_LE",
-          Utility.getContext(this, vars, "#AccessibleOrgTree", "ReportCashFlow"),
+          "AD_OrgType_BU_LE", Utility.getContext(this, vars, "#User_Org", "ReportCashFlow"),
           Utility.getContext(this, vars, "#User_Client", "ReportCashFlow"), 0);
       Utility.fillSQLParameters(this, vars, null, comboTableData, "ReportCashFlow", "");
       xmlDocument.setData("reportAD_ORG", "liststructure", comboTableData.select(false));
--- a/src/org/openbravo/erpCommon/ad_reports/ReportInvoiceCustomerDimensionalAnalysesJR.java	Thu Mar 12 12:00:30 2015 +0100
+++ b/src/org/openbravo/erpCommon/ad_reports/ReportInvoiceCustomerDimensionalAnalysesJR.java	Tue Feb 17 12:33:34 2015 +0100
@@ -433,7 +433,7 @@
 
     try {
       ComboTableData comboTableData = new ComboTableData(vars, this, "TABLEDIR", "AD_Org_ID", "",
-          "", Utility.getContext(this, vars, "#AccessibleOrgTree",
+          "", Utility.getContext(this, vars, "#User_Org",
               "ReportInvoiceCustomerDimensionalAnalysesJR"), Utility.getContext(this, vars,
               "#User_Client", "ReportInvoiceCustomerDimensionalAnalysesJR"), 0);
       Utility.fillSQLParameters(this, vars, null, comboTableData,
--- a/src/org/openbravo/erpCommon/ad_reports/ReportMaterialDimensionalAnalysesJR.java	Thu Mar 12 12:00:30 2015 +0100
+++ b/src/org/openbravo/erpCommon/ad_reports/ReportMaterialDimensionalAnalysesJR.java	Tue Feb 17 12:33:34 2015 +0100
@@ -282,9 +282,8 @@
 
     try {
       ComboTableData comboTableData = new ComboTableData(vars, this, "TABLEDIR", "AD_Org_ID", "",
-          "", Utility.getContext(this, vars, "#AccessibleOrgTree",
-              "ReportMaterialDimensionalAnalyzeJR"), Utility.getContext(this, vars, "#User_Client",
-              "ReportMaterialDimensionalAnalyzeJR"), 0);
+          "", Utility.getContext(this, vars, "#User_Org", "ReportMaterialDimensionalAnalyzeJR"),
+          Utility.getContext(this, vars, "#User_Client", "ReportMaterialDimensionalAnalyzeJR"), 0);
       Utility.fillSQLParameters(this, vars, null, comboTableData,
           "ReportMaterialDimensionalAnalyzeJR", strOrg);
       xmlDocument.setData("reportAD_ORGID", "liststructure", comboTableData.select(false));
--- a/src/org/openbravo/erpCommon/ad_reports/ReportOrderNotInvoiceJR.java	Thu Mar 12 12:00:30 2015 +0100
+++ b/src/org/openbravo/erpCommon/ad_reports/ReportOrderNotInvoiceJR.java	Tue Feb 17 12:33:34 2015 +0100
@@ -164,7 +164,7 @@
     }
     try {
       ComboTableData comboTableData = new ComboTableData(vars, this, "TABLEDIR", "AD_Org_ID", "",
-          "", Utility.getContext(this, vars, "#AccessibleOrgTree", "ReportOrderNotInvoiceJR"),
+          "", Utility.getContext(this, vars, "#User_Org", "ReportOrderNotInvoiceJR"),
           Utility.getContext(this, vars, "#User_Client", "ReportOrderNotInvoiceJR"), 0);
       Utility.fillSQLParameters(this, vars, null, comboTableData, "ReportOrderNotInvoiceJR",
           strCOrgId);
--- a/src/org/openbravo/erpCommon/ad_reports/ReportParetoProduct.java	Thu Mar 12 12:00:30 2015 +0100
+++ b/src/org/openbravo/erpCommon/ad_reports/ReportParetoProduct.java	Tue Feb 17 12:33:34 2015 +0100
@@ -225,9 +225,9 @@
 
       try {
         ComboTableData comboTableData = new ComboTableData(vars, this, "TABLEDIR", "AD_Org_ID", "",
-            "D4DF252DEC3B44858454EE5292A8B836", Utility.getContext(this, vars,
-                "#AccessibleOrgTree", "ReportParetoProduct"), Utility.getContext(this, vars,
-                "#User_Client", "ReportParetoProduct"), 0);
+            "D4DF252DEC3B44858454EE5292A8B836", Utility.getContext(this, vars, "#User_Org",
+                "ReportParetoProduct"), Utility.getContext(this, vars, "#User_Client",
+                "ReportParetoProduct"), 0);
         Utility.fillSQLParameters(this, vars, null, comboTableData, "ReportParetoProduct",
             strAD_Org_ID);
         xmlDocument.setData("reportAD_Org_ID", "liststructure", comboTableData.select(false));
--- a/src/org/openbravo/erpCommon/ad_reports/ReportProjectProfitabilityJR.java	Thu Mar 12 12:00:30 2015 +0100
+++ b/src/org/openbravo/erpCommon/ad_reports/ReportProjectProfitabilityJR.java	Tue Feb 17 12:33:34 2015 +0100
@@ -361,7 +361,7 @@
       comboTableData = null;
 
       comboTableData = new ComboTableData(vars, this, "TABLEDIR", "AD_Org_ID", "", "",
-          Utility.getContext(this, vars, "#AccessibleOrgTree", "ReportProjectProfitabilityJR"),
+          Utility.getContext(this, vars, "#User_Org", "ReportProjectProfitabilityJR"),
           Utility.getContext(this, vars, "#User_Client", "ReportProjectProfitabilityJR"), 0);
       Utility.fillSQLParameters(this, vars, null, comboTableData, "ReportProjectProfitabilityJR",
           strOrg);
--- a/src/org/openbravo/erpCommon/ad_reports/ReportRefundSalesDimensionalAnalyses.java	Thu Mar 12 12:00:30 2015 +0100
+++ b/src/org/openbravo/erpCommon/ad_reports/ReportRefundSalesDimensionalAnalyses.java	Tue Feb 17 12:33:34 2015 +0100
@@ -266,9 +266,8 @@
     }
     try {
       ComboTableData comboTableData = new ComboTableData(vars, this, "TABLEDIR", "AD_Org_ID", "",
-          "", Utility.getContext(this, vars, "#AccessibleOrgTree",
-              "ReportRefundSalesDimensionalAnalyses"), Utility.getContext(this, vars,
-              "#User_Client", "ReportRefundSalesDimensionalAnalyses"), 0);
+          "", Utility.getContext(this, vars, "#User_Org", "ReportRefundSalesDimensionalAnalyses"),
+          Utility.getContext(this, vars, "#User_Client", "ReportRefundSalesDimensionalAnalyses"), 0);
       Utility.fillSQLParameters(this, vars, null, comboTableData,
           "ReportRefundSalesDimensionalAnalyses", strOrg);
       xmlDocument.setData("reportAD_ORGID", "liststructure", comboTableData.select(false));
@@ -424,7 +423,8 @@
         intDiscard++;
       } else if (strShownArray[i].equals("4")) {
         strTextShow[i] = "AD_COLUMN_IDENTIFIER(to_char('M_Product'), to_char( M_PRODUCT.M_PRODUCT_ID), to_char('"
-            + vars.getLanguage() + "'))|| CASE WHEN uomsymbol IS NULL THEN '' ELSE to_char(' ('||uomsymbol||')') END";
+            + vars.getLanguage()
+            + "'))|| CASE WHEN uomsymbol IS NULL THEN '' ELSE to_char(' ('||uomsymbol||')') END";
         intAuxDiscard = i;
         intDiscard++;
       } else if (strShownArray[i].equals("5")) {
--- a/src/org/openbravo/erpCommon/ad_reports/ReportShipmentDimensionalAnalyzeJR.java	Thu Mar 12 12:00:30 2015 +0100
+++ b/src/org/openbravo/erpCommon/ad_reports/ReportShipmentDimensionalAnalyzeJR.java	Tue Feb 17 12:33:34 2015 +0100
@@ -334,9 +334,8 @@
     }
     try {
       ComboTableData comboTableData = new ComboTableData(vars, this, "TABLEDIR", "AD_Org_ID", "",
-          "", Utility.getContext(this, vars, "#AccessibleOrgTree",
-              "ReportShipmentDimensionalAnalyzeJR"), Utility.getContext(this, vars, "#User_Client",
-              "ReportShipmentDimensionalAnalyzeJR"), 0);
+          "", Utility.getContext(this, vars, "#User_Org", "ReportShipmentDimensionalAnalyzeJR"),
+          Utility.getContext(this, vars, "#User_Client", "ReportShipmentDimensionalAnalyzeJR"), 0);
       Utility.fillSQLParameters(this, vars, null, comboTableData,
           "ReportShipmentDimensionalAnalyzeJR", strOrg);
       xmlDocument.setData("reportAD_ORGID", "liststructure", comboTableData.select(false));
@@ -594,10 +593,10 @@
       strHaving = " HAVING (SUM(CONVAMOUNT) > " + strMayor + ")";
     } else if (strMayor.equals("") && !strMenor.equals("")) {
       strHaving = " HAVING (SUM(CONVAMOUNT) < " + strMenor + ")";
-    } 
-    /*else {
-      strHaving = " HAVING (SUM(CONVAMOUNT) <> 0 OR SUM(CONVAMOUNTREF) <> 0)";
-    }*/
+    }
+    /*
+     * else { strHaving = " HAVING (SUM(CONVAMOUNT) <> 0 OR SUM(CONVAMOUNTREF) <> 0)"; }
+     */
     strOrderby = strHaving + strOrderby;
 
     int limit = 0;
--- a/src/org/openbravo/erpCommon/ad_reports/ReportTaxInvoiceJR.java	Thu Mar 12 12:00:30 2015 +0100
+++ b/src/org/openbravo/erpCommon/ad_reports/ReportTaxInvoiceJR.java	Tue Feb 17 12:33:34 2015 +0100
@@ -285,7 +285,7 @@
       log4j.debug("****** setData reportAD_ORGID");
     try {
       ComboTableData comboTableData = new ComboTableData(vars, this, "TABLEDIR", "AD_Org_ID", "",
-          "", Utility.getContext(this, vars, "#AccessibleOrgTree", "ReportTaxInvoiceJR"),
+          "", Utility.getContext(this, vars, "#User_Org", "ReportTaxInvoiceJR"),
           Utility.getContext(this, vars, "#User_Client", "ReportTaxInvoiceJR"), 0);
       Utility.fillSQLParameters(this, vars, null, comboTableData, "ReportTaxInvoiceJR", strOrg);
       xmlDocument.setData("reportAD_ORGID", "liststructure", comboTableData.select(false));