[reconciliation refacor] merge to PI
authorSandra Huguet <sandra.huguet@openbravo.com>
Tue, 23 Sep 2014 10:13:48 +0200
changeset 24692 179d97ee602d
parent 24691 060816ba9ae4 (current diff)
parent 24460 80067e160ad9 (diff)
child 24694 8b66c2c0f6ca
[reconciliation refacor] merge to PI
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/AlertActionHandler.java	Tue Sep 23 08:59:34 2014 +0200
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/AlertActionHandler.java	Tue Sep 23 10:13:48 2014 +0200
@@ -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) 2009-2012 Openbravo SLU 
+ * All portions are Copyright (C) 2009-2014 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -84,9 +84,16 @@
       Long total = 0L;
       if (!"Y".equals(vars.getSessionValue("ApplyModules|BuildRunning"))) {
         // select the alert rules
-        final String hql = "select distinct(e.alertRule) from  " + AlertRecipient.ENTITY_NAME
+        final String hql = "select distinct(e.alertRule) from  "
+            + AlertRecipient.ENTITY_NAME
             + " e where e.alertRule.active = true and (e.userContact.id=? "
-            + " or (e.userContact.id = null and e.role.id = ?))";
+            + " or (e.userContact.id = null and e.role.id = ?))"
+
+            // select only those rules that are client/org visible from current role
+            + " and e.alertRule.client.id " + OBDal.getInstance().getReadableClientsInClause()
+            + " and e.alertRule.organization.id "
+            + OBDal.getInstance().getReadableOrganizationsInClause();
+
         final Query qry = OBDal.getInstance().getSession().createQuery(hql);
         qry.setParameter(0, OBContext.getOBContext().getUser().getId());
         qry.setParameter(1, OBContext.getOBContext().getRole().getId());