details:   http://code.openbravo.com/erp/devel/pi/rev/320cac706beb
changeset: 3345:320cac706beb
user:      Eduardo Argal Guibert <eduardo.argal <at> openbravo.com>
date:      Mon Mar 09 10:10:07 2009 +0100
summary:   Fixes bug 0008020: Initial client setup and initial org setup is not 
working properly with more than one module selected

diffstat:

2 files changed, 68 insertions(+), 10 deletions(-)
src/org/openbravo/erpCommon/ad_forms/InitialClientSetup.java |   57 +++++++++-
src/org/openbravo/erpCommon/ad_forms/InitialOrgSetup.java    |   21 ++-

diffs (148 lines):

diff -r 7c9f9d295428 -r 320cac706beb 
src/org/openbravo/erpCommon/ad_forms/InitialClientSetup.java
--- a/src/org/openbravo/erpCommon/ad_forms/InitialClientSetup.java      Fri Mar 
06 19:19:52 2009 +0100
+++ b/src/org/openbravo/erpCommon/ad_forms/InitialClientSetup.java      Mon Mar 
09 10:10:07 2009 +0100
@@ -1415,11 +1415,33 @@
     return C_DocType_ID;
   } // createDocType
 
+  /**
+   * Returns the error. "" if there is no error
+   * 
+   * @param conn
+   * @param vars
+   * @param strClient
+   * @param strModules
+   * @param strCurrency
+   * @param hasProduct
+   * @param hasBPartner
+   * @param hasProject
+   * @param hasMCampaign
+   * @param hasSRegion
+   * @param bCreateAccounting
+   * @return
+   */
+
   public String createReferenceData(Connection conn, VariablesSecureApp vars, 
String strClient,
       String strModules, String strCurrency, boolean hasProduct, boolean 
hasBPartner,
       boolean hasProject, boolean hasMCampaign, boolean hasSRegion, boolean 
bCreateAccounting)
-      throws ServletException, IOException {
+      throws ServletException, IOException, SQLException, 
NoConnectionAvailableException {
     if (strModules != null && !strModules.equals("")) {
+      // Remove ( ) characters from the In string as it causes a failure
+      if (strModules.charAt(0) == '(')
+        strModules = strModules.substring(1, strModules.length());
+      if (strModules.charAt(strModules.length() - 1) == ')')
+        strModules = strModules.substring(0, strModules.length() - 1);
       InitialClientSetupData[] data = 
InitialClientSetupData.selectModules(this, strModules);
       data = orderModuleByDependency(data);
       if (data != null && data.length != 0) {
@@ -1429,9 +1451,18 @@
             String strPath = vars.getSessionValue("#SOURCEPATH") + "/modules" 
+ data[i].path;
             FileInputStream in = new FileInputStream(strPath);
             AccountingValueData av = new AccountingValueData(vars, in, true, 
"C");
-            createAccounting(conn, vars, strCurrency, 
InitialClientSetupData.currency(this,
+            m_info.append(SALTO_LINEA).append(
+                Utility.messageBD(this, "StartingAccounting", 
vars.getLanguage())).append(
+                SALTO_LINEA);
+            if (!createAccounting(conn, vars, strCurrency, 
InitialClientSetupData.currency(this,
                 strCurrency), hasProduct, hasBPartner, hasProject, 
hasMCampaign, hasSRegion, av
-                .getFieldProvider());
+                .getFieldProvider())) {
+              releaseRollbackConnection(conn);
+              conn = this.getTransactionConnection();
+              m_info.append(SALTO_LINEA).append(
+                  Utility.messageBD(this, "CreateAccountingFailed", 
vars.getLanguage())).append(
+                  SALTO_LINEA);
+            }
           }
           String strPath = vars.getSessionValue("#SOURCEPATH") + "/modules/" + 
data[i].javapackage
               + "/referencedata/standard";
@@ -1452,6 +1483,23 @@
                 Client.class, strClient), (Organization) 
OBDal.getInstance().get(
                 Organization.class, "'0'"), strXml, (Module) 
OBDal.getInstance().get(Module.class,
                 data[i].adModuleId));
+            m_info.append(SALTO_LINEA).append("File: 
").append(myFiles[j].getName()).append(":")
+                .append(SALTO_LINEA);
+            if (myResult.getLogMessages() != null && 
!myResult.getLogMessages().equals("")
+                && !myResult.getLogMessages().equals("null")) {
+              m_info.append(SALTO_LINEA).append("LOG:").append(SALTO_LINEA);
+              
m_info.append(SALTO_LINEA).append(myResult.getLogMessages()).append(SALTO_LINEA);
+            }
+            if (myResult.getWarningMessages() != null && 
!myResult.getWarningMessages().equals("")
+                && !myResult.getWarningMessages().equals("null")) {
+              
m_info.append(SALTO_LINEA).append("WARNINGS:").append(SALTO_LINEA);
+              
m_info.append(SALTO_LINEA).append(myResult.getWarningMessages()).append(SALTO_LINEA);
+            }
+            if (myResult.getErrorMessages() != null && 
!myResult.getErrorMessages().equals("")
+                && !myResult.getErrorMessages().equals("null")) {
+              m_info.append(SALTO_LINEA).append("ERRORS:").append(SALTO_LINEA);
+              
m_info.append(SALTO_LINEA).append(myResult.getErrorMessages()).append(SALTO_LINEA);
+            }
             if (myResult.getErrorMessages() != null && 
!myResult.getErrorMessages().equals(""))
               strError = strError.append(myResult.getErrorMessages());
           }
@@ -1467,13 +1515,12 @@
                 Utility.messageBD(this, "CreateReferenceDataSuccess", 
vars.getLanguage())).append(
                 SALTO_LINEA);
           }
-          return "";
         }
+        return "";
       } else
         return "WrongModules";
     } else
       return "NoModules";
-    return strError;
   }
 
   /**
diff -r 7c9f9d295428 -r 320cac706beb 
src/org/openbravo/erpCommon/ad_forms/InitialOrgSetup.java
--- a/src/org/openbravo/erpCommon/ad_forms/InitialOrgSetup.java Fri Mar 06 
19:19:52 2009 +0100
+++ b/src/org/openbravo/erpCommon/ad_forms/InitialOrgSetup.java Mon Mar 09 
10:10:07 2009 +0100
@@ -1043,6 +1043,11 @@
       boolean hasProject, boolean hasMCampaign, boolean hasSRegion, String 
strCreateAccounting)
       throws ServletException, IOException {
     if (strModules != null && !strModules.equals("")) {
+      // Remove ( ) characters from the In string as it causes a failure
+      if (strModules.charAt(0) == '(')
+        strModules = strModules.substring(1, strModules.length());
+      if (strModules.charAt(strModules.length() - 1) == ')')
+        strModules = strModules.substring(0, strModules.length() - 1);
       InitialOrgSetupData[] data = InitialOrgSetupData.selectModules(this, 
strModules);
       data = orderModuleByDependency(data);
       if (data != null && data.length != 0) {
@@ -1052,9 +1057,16 @@
             final String strPath = vars.getSessionValue("#SOURCEPATH") + 
"/modules" + data[i].path;
             final FileInputStream in = new FileInputStream(strPath);
             final AccountingValueData av = new AccountingValueData(vars, in, 
true, "C");
-            createAccounting(vars, strOrganization, C_Currency_ID, 
InitialOrgSetupData.currency(
-                this, C_Currency_ID), hasProduct, hasBPartner, hasProject, 
hasMCampaign,
-                hasSRegion, av.getFieldProvider());
+            m_info.append(SALTO_LINEA).append(
+                Utility.messageBD(this, "StartingAccounting", 
vars.getLanguage())).append(
+                SALTO_LINEA);
+            if (!createAccounting(vars, strOrganization, C_Currency_ID, 
InitialOrgSetupData
+                .currency(this, C_Currency_ID), hasProduct, hasBPartner, 
hasProject, hasMCampaign,
+                hasSRegion, av.getFieldProvider())) {
+              m_info.append(SALTO_LINEA).append(
+                  Utility.messageBD(this, "CreateAccountingFailed", 
vars.getLanguage())).append(
+                  SALTO_LINEA);
+            }
           }
           final String strPath = vars.getSessionValue("#SOURCEPATH") + 
"/modules/"
               + data[i].javapackage + "/referencedata/standard";
@@ -1107,13 +1119,12 @@
                 Utility.messageBD(this, "CreateReferenceDataSuccess", 
vars.getLanguage())).append(
                 SALTO_LINEA);
           }
-          return "";
         }
+        return "";
       } else
         return "WrongModules";
     } else
       return "NoModules";
-    return "";
   }
 
   /**

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to