details:   /erp/devel/pi/rev/632808419bb4
changeset: 8563:632808419bb4
user:      Sivaraman Rajagopal <sivaraman.rajagopal <at> openbravo.com>
date:      Tue Oct 19 17:13:17 2010 +0530
summary:   Fixes issue 9422: CreateTaxReport & CreateAccountingReport: static 
class members

As per the proposed solution, strTreeOrg has been moved to printPagePopup as 
local variable and passed into treeOrg as parameter. Please note, String type 
has been changed to StringBuffer in order to use treeOrg without having major 
changes.

diffstat:

 src/org/openbravo/erpCommon/ad_process/CreateAccountingReport.java |  35 
+++++----
 src/org/openbravo/erpCommon/ad_process/CreateTaxReport.java        |  36 
+++++-----
 2 files changed, 37 insertions(+), 34 deletions(-)

diffs (180 lines):

diff -r eb105fcc4400 -r 632808419bb4 
src/org/openbravo/erpCommon/ad_process/CreateAccountingReport.java
--- a/src/org/openbravo/erpCommon/ad_process/CreateAccountingReport.java        
Tue Oct 19 09:29:36 2010 +0200
+++ b/src/org/openbravo/erpCommon/ad_process/CreateAccountingReport.java        
Tue Oct 19 17:13:17 2010 +0530
@@ -45,7 +45,6 @@
 
 public class CreateAccountingReport extends HttpSecureAppServlet {
   private static final long serialVersionUID = 1L;
-  private static String strTreeOrg = "";
 
   public void init(ServletConfig config) {
     super.init(config);
@@ -97,9 +96,9 @@
       pageErrorPopUp(response);
   }
 
-  private void printPage(HttpServletResponse response, VariablesSecureApp 
vars, String strcAcctSchemaId,
-      String strAccountingReportId, String strOrg, String strPeriod, String 
strYear,
-      String strProcessId) throws IOException, ServletException {
+  private void printPage(HttpServletResponse response, VariablesSecureApp vars,
+      String strcAcctSchemaId, String strAccountingReportId, String strOrg, 
String strPeriod,
+      String strYear, String strProcessId) throws IOException, 
ServletException {
     if (log4j.isDebugEnabled())
       log4j.debug("Output: process CreateAccountingReport");
 
@@ -245,17 +244,16 @@
         .getSqlDateFormat());
     strPeriodTo = CreateAccountingReportData.selectFormat(this, strPeriodTo, 
vars
         .getSqlDateFormat());
-    strTreeOrg = strOrg;
-    treeOrg(vars, strOrg);
+    StringBuilder strTreeOrg = new StringBuilder(strOrg);
+    treeOrg(vars, strOrg, strTreeOrg);
 
     Vector<Object> vectorArray = new Vector<Object>();
 
     childData(vars, vectorArray, strcAcctSchemaId, strAccountingReportId, 
strPeriodFrom,
-        strPeriodTo, strTreeOrg, level, "0", strPeriod);
+        strPeriodTo, strTreeOrg.toString(), level, "0", strPeriod);
 
     CreateAccountingReportData[] dataTree = convertVector(vectorArray);
     dataTree = filterData(dataTree);
-    strTreeOrg = "";
 
     xmlDocument.setParameter("title", dataTree[0].name);
     xmlDocument.setParameter("directory", "var baseDirectory = \"" + 
strReplaceWith + "/\";\n");
@@ -268,7 +266,8 @@
     out.close();
   }
 
-  private String arrayEntry(VariablesSecureApp vars, String strcAcctSchemaId) 
throws ServletException {
+  private String arrayEntry(VariablesSecureApp vars, String strcAcctSchemaId)
+      throws ServletException {
     String result = "";
     CreateAccountingReportData[] data = CreateAccountingReportData
         .selectAD_Accountingrpt_Element_ID(this, Utility.getContext(this, 
vars, "#User_Org",
@@ -306,20 +305,23 @@
     return result;
   }
 
-  private void treeOrg(VariablesSecureApp vars, String strOrg) throws 
ServletException {
+  private void treeOrg(VariablesSecureApp vars, String strOrg, StringBuilder 
treeOrg)
+      throws ServletException {
     CreateAccountingReportData[] dataOrg = 
CreateAccountingReportData.selectOrg(this, strOrg, vars
         .getClient());
     for (int i = 0; i < dataOrg.length; i++) {
-      strTreeOrg += "," + dataOrg[i].id;
+      treeOrg.append(",");
+      treeOrg.append(dataOrg[i].id);
       if (dataOrg[i].issummary.equals("Y"))
-        treeOrg(vars, dataOrg[i].id);
+        treeOrg(vars, dataOrg[i].id, treeOrg);
     }
     return;
   }
 
-  private void childData(VariablesSecureApp vars, Vector<Object> vectorArray, 
String strcAcctSchemaId,
-      String strAccountingReportId, String strPeriodFrom, String strPeriodTo, 
String strOrg,
-      int level, String strParent, String strPeriod) throws IOException, 
ServletException {
+  private void childData(VariablesSecureApp vars, Vector<Object> vectorArray,
+      String strcAcctSchemaId, String strAccountingReportId, String 
strPeriodFrom,
+      String strPeriodTo, String strOrg, int level, String strParent, String 
strPeriod)
+      throws IOException, ServletException {
     if (log4j.isDebugEnabled())
       log4j.debug("**********************strAccountingReportId: " + 
strAccountingReportId);
     if (log4j.isDebugEnabled())
@@ -378,7 +380,8 @@
     }
   }
 
-  private CreateAccountingReportData[] convertVector(Vector<Object> 
vectorArray) throws ServletException {
+  private CreateAccountingReportData[] convertVector(Vector<Object> 
vectorArray)
+      throws ServletException {
     CreateAccountingReportData[] data = new 
CreateAccountingReportData[vectorArray.size()];
     BigDecimal count = BigDecimal.ZERO;
     for (int i = 0; i < vectorArray.size(); i++) {
diff -r eb105fcc4400 -r 632808419bb4 
src/org/openbravo/erpCommon/ad_process/CreateTaxReport.java
--- a/src/org/openbravo/erpCommon/ad_process/CreateTaxReport.java       Tue Oct 
19 09:29:36 2010 +0200
+++ b/src/org/openbravo/erpCommon/ad_process/CreateTaxReport.java       Tue Oct 
19 17:13:17 2010 +0530
@@ -43,8 +43,6 @@
 
 public class CreateTaxReport extends HttpSecureAppServlet {
   private static final long serialVersionUID = 1L;
-  private static String strTreeOrg = "";
-  private static int rownum = 1;
 
   public void init(ServletConfig config) {
     super.init(config);
@@ -74,9 +72,9 @@
       pageErrorPopUp(response);
   }
 
-  private void printPage(HttpServletResponse response, VariablesSecureApp 
vars, String strTaxReportId,
-      String strDateFrom, String strDateTo, String strOrg, String 
strProcessId) throws IOException,
-      ServletException {
+  private void printPage(HttpServletResponse response, VariablesSecureApp vars,
+      String strTaxReportId, String strDateFrom, String strDateTo, String 
strOrg,
+      String strProcessId) throws IOException, ServletException {
     if (log4j.isDebugEnabled())
       log4j.debug("Output: process CreateTaxReport");
 
@@ -168,24 +166,24 @@
     out.close();
   }
 
-  private void printPagePopUp(HttpServletResponse response, VariablesSecureApp 
vars, String strTaxReportId,
-      String strDateFrom, String strDateTo, String strOrg) throws IOException, 
ServletException {
+  private void printPagePopUp(HttpServletResponse response, VariablesSecureApp 
vars,
+      String strTaxReportId, String strDateFrom, String strDateTo, String 
strOrg)
+      throws IOException, ServletException {
     if (log4j.isDebugEnabled())
       log4j.debug("Output: pop up CreateTaxReport");
     XmlDocument xmlDocument = xmlEngine.readXmlTemplate(
         
"org/openbravo/erpCommon/ad_process/CreateTaxReportPopUp").createXmlDocument();
     int level = 0;
 
-    strTreeOrg = strOrg;
-    treeOrg(vars, strOrg);
+    StringBuilder strTreeOrg = new StringBuilder(strOrg);
+    treeOrg(vars, strOrg, strTreeOrg);
 
     Vector<Object> vectorArray = new Vector<Object>();
 
-    childData(vars, vectorArray, strTaxReportId, strDateFrom, strDateTo, 
strTreeOrg, level, "0",
-        rownum);
+    childData(vars, vectorArray, strTaxReportId, strDateFrom, strDateTo, 
strTreeOrg.toString(),
+        level, "0", 1);
 
     CreateTaxReportData[] dataTree = convertVector(vectorArray);
-    strTreeOrg = "";
     xmlDocument.setParameter("directory", "var baseDirectory = \"" + 
strReplaceWith + "/\";\n");
     xmlDocument.setParameter("language", "defaultLang=\"" + vars.getLanguage() 
+ "\";");
     xmlDocument.setParameter("theme", vars.getTheme());
@@ -208,19 +206,21 @@
    * (i<data.length-1) result += ",\n"; } result += ");"; } return result; }
    */
 
-  private void treeOrg(VariablesSecureApp vars, String strOrg) throws 
ServletException {
+  private void treeOrg(VariablesSecureApp vars, String strOrg, StringBuilder 
treeOrg)
+      throws ServletException {
     CreateTaxReportData[] dataOrg = CreateTaxReportData.selectOrg(this, 
strOrg, vars.getClient());
     for (int i = 0; i < dataOrg.length; i++) {
-      strTreeOrg += "," + dataOrg[i].id;
+      treeOrg.append(",");
+      treeOrg.append(dataOrg[i].id);
       if (dataOrg[i].issummary.equals("Y"))
-        treeOrg(vars, dataOrg[i].id);
+        treeOrg(vars, dataOrg[i].id, treeOrg);
     }
     return;
   }
 
-  private void childData(VariablesSecureApp vars, Vector<Object> vectorArray, 
String strTaxReportId,
-      String strPeriodFrom, String strPeriodTo, String strOrg, int level, 
String strParent,
-      int rownum) throws IOException, ServletException {
+  private void childData(VariablesSecureApp vars, Vector<Object> vectorArray,
+      String strTaxReportId, String strPeriodFrom, String strPeriodTo, String 
strOrg, int level,
+      String strParent, int rownum) throws IOException, ServletException {
     if (log4j.isDebugEnabled())
       log4j.debug("**********************strTaxReportId: " + strTaxReportId);
     if (log4j.isDebugEnabled())

------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly 
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to