details:   /erp/devel/pi/rev/81c9928424fa
changeset: 10874:81c9928424fa
user:      David Alsasua <david.alsasua <at> openbravo.com>
date:      Thu Feb 24 17:26:32 2011 +0100
summary:   Fixes issue 16007: account tree is wrong

diffstat:

 src/org/openbravo/erpCommon/businessUtility/COAUtility.java |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (34 lines):

diff -r 9445846b27bd -r 81c9928424fa 
src/org/openbravo/erpCommon/businessUtility/COAUtility.java
--- a/src/org/openbravo/erpCommon/businessUtility/COAUtility.java       Thu Feb 
24 16:23:58 2011 +0100
+++ b/src/org/openbravo/erpCommon/businessUtility/COAUtility.java       Thu Feb 
24 17:26:32 2011 +0100
@@ -31,6 +31,7 @@
 import org.apache.log4j.Logger;
 import org.openbravo.base.VariablesBase;
 import org.openbravo.base.secureApp.VariablesSecureApp;
+import org.openbravo.dal.core.OBContext;
 import org.openbravo.dal.service.OBDal;
 import org.openbravo.data.FieldProvider;
 import org.openbravo.erpCommon.utility.OBError;
@@ -733,7 +734,7 @@
         .debug("insertElementValuesInDB() - All accounts processed correctly. 
Updating tree node.");
     List<TreeNode> lTreeNodes = null;
     try {
-      lTreeNodes = InitialSetupUtility.getTreeNode(treeAccount, client);
+      lTreeNodes = InitialSetupUtility.getTreeNode(treeAccount, client, 
organization);
       if (lTreeNodes == null)
         logEvent("@AccountTreeNotSorted@");
       else {
@@ -742,7 +743,12 @@
         InitialSetupUtility.updateAccountTree(lTreeNodes, mapSequence, 
mapElementValueValue,
             mapElementValueId, mapParent, false);
         log4j.debug("insertElementValuesInDB() - Account tree updated.");
-        OBDal.getInstance().flush();
+        try {
+          OBContext.setAdminMode();
+          OBDal.getInstance().flush();
+        } finally {
+          OBContext.restorePreviousMode();
+        }
       }
     } catch (Exception e) {
       logEvent("@AccountTreeNotSorted@");

------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to