details:   https://code.openbravo.com/erp/devel/pi/rev/69d9309e5550
changeset: 18498:69d9309e5550
user:      Eduardo Argal Guibert <eduardo.argal <at> openbravo.com>
date:      Wed Nov 07 13:46:39 2012 +0100
summary:   Fixes bug 22229

diffstat:

 src-db/database/model/triggers/C_ELEMENTVALUE_TRG.xml       |   2 +-
 src/org/openbravo/erpCommon/businessUtility/COAUtility.java |  23 ++++++++++--
 2 files changed, 20 insertions(+), 5 deletions(-)

diffs (80 lines):

diff -r 22b019b64170 -r 69d9309e5550 
src-db/database/model/triggers/C_ELEMENTVALUE_TRG.xml
--- a/src-db/database/model/triggers/C_ELEMENTVALUE_TRG.xml     Tue Nov 06 
19:38:59 2012 +0100
+++ b/src-db/database/model/triggers/C_ELEMENTVALUE_TRG.xml     Wed Nov 07 
13:46:39 2012 +0100
@@ -151,7 +151,7 @@
                      SET Updated=now(), isactive = 'N'                         
  
                      WHERE Account_ID=:new.C_ElementValue_ID;
      END IF;         
-     IF(:old.elementlevel <> 'S' and :new.elementlevel = 'S') THEN
+     IF(:new.elementlevel = 'S') THEN
         SELECT COUNT(*)
         INTO v_Count
         FROM C_VALIDCOMBINATION
diff -r 22b019b64170 -r 69d9309e5550 
src/org/openbravo/erpCommon/businessUtility/COAUtility.java
--- a/src/org/openbravo/erpCommon/businessUtility/COAUtility.java       Tue Nov 
06 19:38:59 2012 +0100
+++ b/src/org/openbravo/erpCommon/businessUtility/COAUtility.java       Wed Nov 
07 13:46:39 2012 +0100
@@ -76,6 +76,7 @@
   private StringBuffer strLog = new StringBuffer();
   private Calendar calendar;
   private Element element;
+  private AcctSchema acctSchema = null;
   private static final Logger log4j = Logger.getLogger(COAUtility.class);
 
   public COAUtility(Client clientProvided, Tree treeAccountProvided) {
@@ -151,6 +152,13 @@
       return obeResult;
     log4j.debug("createAccounting() - Element correctly inserted");
 
+    log4j.debug("createAccounting() - Inserting accounting schema (general 
ledger)");
+    obeResult = insertAccountingSchema(strGAAPProvided, 
strCostingMethodProvided, currency,
+        hasBPartner, hasProduct, hasProject, hasMCampaign, hasSRegion);
+    if (!obeResult.getType().equals(strMessageOk))
+      return obeResult;
+    log4j.debug("createAccounting() - Accounting schema (general ledger) 
correctly inserted");
+
     log4j.debug("createAccounting() - Inserting accounts from file");
     obeResult = insertElementValues(vars, fileCoA);
     if (!obeResult.getType().equals(strMessageOk))
@@ -159,9 +167,8 @@
     // Not meaningful message, but set to keep backwards compatibility
     logEvent("@C_ElementValue_ID@ #");
 
-    log4j.debug("createAccounting() - Inserting accounting schema (general 
ledger)");
-    obeResult = insertAccountingSchema(strGAAPProvided, 
strCostingMethodProvided, currency,
-        hasBPartner, hasProduct, hasProject, hasMCampaign, hasSRegion);
+    log4j.debug("createAccounting() - Inserting accounting schema (general 
ledger and defaults)");
+    obeResult = insertAccountingSchemaGLDefaults(acctSchema);
     if (!obeResult.getType().equals(strMessageOk))
       return obeResult;
     log4j.debug("createAccounting() - Accounting schema (general ledger) 
correctly inserted");
@@ -238,7 +245,6 @@
         + " " + strGAAP + "/" + strCostingMethod + "/" + 
currency.getDescription();
     log4j.debug("insertAccountingSchema() - Creating accounting schema 
(general ledger) "
         + strAcctSchemaName);
-    AcctSchema acctSchema = null;
     try {
       acctSchema = InitialSetupUtility.insertAcctSchema(client, organization, 
currency,
           strAcctSchemaName, strGAAP, strCostingMethod, true);
@@ -395,6 +401,14 @@
     }
     log4j.debug("insertAccountingSchema() - All acct.schema elements correctly 
inserted."
         + " Inserting acct.schema gl account combinations");
+
+    return obeResult;
+  }
+
+  private OBError insertAccountingSchemaGLDefaults(AcctSchema acctSchema) {
+    OBError obeResult = new OBError();
+    obeResult.setType(strMessageOk);
+
     AcctSchemaGL acctSchGL;
     try {
       acctSchGL = InitialSetupUtility.insertAcctSchemaGL(defaultElementValues, 
acctSchema);
@@ -443,6 +457,7 @@
       }
     }
     return obeResult;
+
   }
 
   private COAData[] parseCOA(VariablesBase vars, InputStream instFile) throws 
IOException {

------------------------------------------------------------------------------
LogMeIn Central: Instant, anywhere, Remote PC access and management.
Stay in control, update software, and manage PCs from one command center
Diagnose problems and improve visibility into emerging IT issues
Automate, monitor and manage. Do more in less time with Central
http://p.sf.net/sfu/logmein12331_d2d
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to