details:   https://code.openbravo.com/erp/devel/pi/rev/63b2919451b9
changeset: 33010:63b2919451b9
user:      Inigo Sanchez <inigo.sanchez <at> openbravo.com>
date:      Thu Nov 16 12:33:12 2017 +0100
summary:   Fixed issue 37289: Deactivated orgs are displayed in the user 
profile widget

The problem was caused by the "Improve scalability of the login process" 
project. When improving the performance
of the query that return the complete organizations list for the current user, 
the OBQuery instance used to generate it was
replaced with a Query instance. The first includes by default the filter by is 
active.

To fix the problem this filter must be added manually in the query. Now the 
problem has been resolved by take into
account this filter. Besides the same problem is detected in other query 
related with deactivated warehouses so it is fixed too.

diffstat:

 
modules/org.openbravo.client.application/src/org/openbravo/client/application/navigationbarcomponents/RoleInfo.java
 |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diffs (21 lines):

diff -r e7913c7e9ed0 -r 63b2919451b9 
modules/org.openbravo.client.application/src/org/openbravo/client/application/navigationbarcomponents/RoleInfo.java
--- 
a/modules/org.openbravo.client.application/src/org/openbravo/client/application/navigationbarcomponents/RoleInfo.java
       Thu Nov 16 12:32:13 2017 +0100
+++ 
b/modules/org.openbravo.client.application/src/org/openbravo/client/application/navigationbarcomponents/RoleInfo.java
       Thu Nov 16 12:33:12 2017 +0100
@@ -86,7 +86,7 @@
 
     final StringBuilder hql = new StringBuilder();
     hql.append("select ro.organization.id, ro.organization.name from 
ADRoleOrganization ro ");
-    hql.append("where ro.role.id=:roleId and ro.organization.active=true ");
+    hql.append("where ro.active=true and ro.role.id=:roleId and 
ro.organization.active=true ");
     Query roleOrgs = 
OBDal.getInstance().getSession().createQuery(hql.toString());
     roleOrgs.setString("roleId", roleId);
     for (Object entry : roleOrgs.list()) {
@@ -112,7 +112,7 @@
 
     final StringBuilder hql = new StringBuilder();
     hql.append("select w.id, w.name, w.organization.id from Warehouse w ");
-    hql.append("where w.organization.id in (:orgList) and 
w.client.id=:clientId and w.organization.active=true ");
+    hql.append("where w.active=true and w.organization.id in (:orgList) and 
w.client.id=:clientId and w.organization.active=true ");
     Query orgWarehouses = 
OBDal.getInstance().getSession().createQuery(hql.toString());
     orgWarehouses.setParameterList("orgList", getOrganizations().keySet());
     orgWarehouses.setString("clientId", clientId);

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to