From 8693efdb127c9ee206ce438c633ee7c894763252 Mon Sep 17 00:00:00 2001 From: Deepak Srivastava Date: Fri, 5 Apr 2013 14:11:20 +0530 Subject: [PATCH] CRM-12225 --- CRM/Group/Page/AJAX.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CRM/Group/Page/AJAX.php b/CRM/Group/Page/AJAX.php index eeebc01953..8a861835b4 100644 --- a/CRM/Group/Page/AJAX.php +++ b/CRM/Group/Page/AJAX.php @@ -69,6 +69,18 @@ class CRM_Group_Page_AJAX { // get group list $groups = CRM_Contact_BAO_Group::getGroupListSelector($params); + // if no groups found with parent-child hierarchy and logged in user say can view child groups only (an ACL case), + // go ahead with flat hierarchy, CRM-12225 + if (empty($groups)) { + $groupsAccessible = CRM_Core_PseudoConstant::group(); + $parentsOnly = CRM_Utils_Array::value('parentsOnly', $params); + if (!empty($groupsAccessible) && $parentsOnly) { + // recompute group list with flat hierarchy + $params['parentsOnly'] = 0; + $groups = CRM_Contact_BAO_Group::getGroupListSelector($params); + } + } + $iFilteredTotal = $iTotal = $params['total']; $selectorElements = array( 'group_name', 'group_id', 'created_by', 'group_description', -- 2.25.1