fixes for CRM-13220
authorkurund <kurund@civicrm.org>
Tue, 13 Aug 2013 21:16:50 +0000 (02:46 +0530)
committerkurund <kurund@civicrm.org>
Tue, 13 Aug 2013 21:16:50 +0000 (02:46 +0530)
----------------------------------------
* CRM-13220: Events listing ( html ) is broken
  http://issues.civicrm.org/jira/browse/CRM-13220

CRM/ACL/BAO/ACL.php

index b2b197a784ec2d6450213969559de6fb1e1d3b67..a4cc176796603b9796ee27ba5b78a2a77101082c 100644 (file)
@@ -822,15 +822,6 @@ SELECT g.*
 
     $acls = CRM_ACL_BAO_Cache::build($contactID);
 
-    if (!empty($includedGroups) &&
-      is_array($includedGroups)
-    ) {
-      $ids = $includedGroups;
-    }
-    else {
-      $ids = array();
-    }
-
     if (!empty($acls)) {
       $aclKeys = array_keys($acls);
       $aclKeys = implode(',', $aclKeys);
@@ -851,7 +842,9 @@ ORDER BY a.object_id
 ";
         $params = array(1 => array($tableName, 'String'));
         $dao = CRM_Core_DAO::executeQuery($query, $params);
+        $aclFound = FALSE;
         while ($dao->fetch()) {
+          $aclFound = TRUE;
           if ($dao->object_id) {
             if (self::matchType($type, $dao->operation)) {
               $ids[] = $dao->object_id;
@@ -868,6 +861,18 @@ ORDER BY a.object_id
             break;
           }
         }
+
+        if (!$aclFound) {
+          if (!empty($includedGroups) &&
+            is_array($includedGroups)
+          ) {
+            $ids = $includedGroups;
+          }
+          else {
+            $ids = array();
+          }
+        }
+
         $cache->set($cacheKey, $ids);
       }
     }