[Tree Extension] OrganizationStructureProvider does not use treetype
authorAugusto Mauch <augusto.mauch@openbravo.com>
Fri, 28 Feb 2014 11:59:21 +0100
changeset 22593 469384f8bd93
parent 22592 a342407f0142
child 22594 56250da17af1
[Tree Extension] OrganizationStructureProvider does not use treetype
src/org/openbravo/dal/security/OrganizationStructureProvider.java
--- a/src/org/openbravo/dal/security/OrganizationStructureProvider.java	Fri Feb 28 11:50:49 2014 +0100
+++ b/src/org/openbravo/dal/security/OrganizationStructureProvider.java	Fri Feb 28 11:59:21 2014 +0100
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2008-2011 Openbravo SLU 
+ * All portions are Copyright (C) 2008-2014 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -56,6 +56,7 @@
   private Map<String, Set<String>> naturalTreesByOrgID = new HashMap<String, Set<String>>();
   private Map<String, String> parentByOrganizationID = new HashMap<String, String>();
   private Map<String, Set<String>> childByOrganizationID = new HashMap<String, Set<String>>();
+  private static final String AD_ORG_TABLE_ID = "155";
   private String clientId;
 
   /**
@@ -76,8 +77,8 @@
     }
 
     // read all trees of all clients, bypass DAL to prevent security checks
-    final String qryStr = "select t from " + Tree.class.getName()
-        + " t where treetype='OO' and client.id='" + getClientId() + "'";
+    final String qryStr = "select t from " + Tree.class.getName() + " t where table.id='"
+        + AD_ORG_TABLE_ID + "' and client.id='" + getClientId() + "'";
     final Query qry = SessionHandler.getInstance().createQuery(qryStr);
     @SuppressWarnings("unchecked")
     final List<Tree> ts = qry.list();