From f90c40b98be858978a69d55733f0236e70bcd976 Mon Sep 17 00:00:00 2001 From: "deb.monish" Date: Fri, 8 Apr 2016 14:06:08 +0530 Subject: [PATCH] revert PR 8065 --- CRM/Contact/BAO/Group.php | 3 +- tests/phpunit/CRM/Group/Page/AjaxTest.php | 80 +++++++++++------------ 2 files changed, 42 insertions(+), 41 deletions(-) diff --git a/CRM/Contact/BAO/Group.php b/CRM/Contact/BAO/Group.php index 3a198b0a03..84ca887149 100644 --- a/CRM/Contact/BAO/Group.php +++ b/CRM/Contact/BAO/Group.php @@ -750,7 +750,7 @@ class CRM_Contact_BAO_Group extends CRM_Contact_DAO_Group { $value['class'] = array_diff($value['class'], array('crm-row-parent')); } $group['DT_RowId'] = 'row_' . $value['id']; - if (!empty($params['parentsOnly'])) { + if (!$params['parentsOnly']) { foreach ($value['class'] as $id => $class) { if ($class == 'crm-group-parent') { unset($value['class'][$id]); @@ -801,6 +801,7 @@ class CRM_Contact_BAO_Group extends CRM_Contact_DAO_Group { $config = CRM_Core_Config::singleton(); $whereClause = self::whereClause($params, FALSE); + //$this->pagerAToZ( $whereClause, $params ); if (!empty($params['rowCount']) && diff --git a/tests/phpunit/CRM/Group/Page/AjaxTest.php b/tests/phpunit/CRM/Group/Page/AjaxTest.php index cbd2f4a9fb..d27085ddb2 100644 --- a/tests/phpunit/CRM/Group/Page/AjaxTest.php +++ b/tests/phpunit/CRM/Group/Page/AjaxTest.php @@ -65,8 +65,8 @@ class CRM_Group_Page_AjaxTest extends CiviUnitTestCase { public function setPermissionAndRequest($permission) { CRM_Core_Config::singleton()->userPermissionClass->permissions = (array) $permission; CRM_Contact_BAO_Group::getPermissionClause(TRUE); - global $_GET; - $_GET = $this->_params; + global $_REQUEST; + $_REQUEST = $this->_params; } /** @@ -77,8 +77,8 @@ class CRM_Group_Page_AjaxTest extends CiviUnitTestCase { CRM_Core_Config::singleton()->userPermissionClass->permissions = (array) $permission; $this->hookClass->setHook('civicrm_aclGroup', array($this, $hook)); CRM_Contact_BAO_Group::getPermissionClause(TRUE); - global $_GET; - $_GET = $this->_params; + global $_REQUEST; + $_REQUEST = $this->_params; } /** @@ -88,8 +88,8 @@ class CRM_Group_Page_AjaxTest extends CiviUnitTestCase { $this->setPermissionAndRequest(array('view all contacts', 'edit groups')); list($groups, $total) = CRM_Group_Page_AJAX::getGroupList(); $this->assertEquals(2, $total); - $this->assertEquals('pick-me-active', $groups[2]['title']); - $this->assertEquals('not-me-active', $groups[4]['title']); + $this->assertEquals('pick-me-active', $groups[2]['group_name']); + $this->assertEquals('not-me-active', $groups[4]['group_name']); } /** @@ -99,15 +99,15 @@ class CRM_Group_Page_AjaxTest extends CiviUnitTestCase { $this->setPermissionAndRequest('view all contacts'); list($groups, $total) = CRM_Group_Page_AJAX::getGroupList(); $this->assertEquals(2, $total); - $this->assertEquals('pick-me-active', $groups[2]['title']); - $this->assertEquals('not-me-active', $groups[4]['title']); + $this->assertEquals('pick-me-active', $groups[2]['group_name']); + $this->assertEquals('not-me-active', $groups[4]['group_name']); // as per changes made in PR-6822 $this->setPermissionAndRequest(array('view all contacts', 'edit groups')); list($groups, $total) = CRM_Group_Page_AJAX::getGroupList(); $this->assertEquals(2, $total); - $this->assertEquals('pick-me-active', $groups[2]['title']); - $this->assertEquals('not-me-active', $groups[4]['title']); + $this->assertEquals('pick-me-active', $groups[2]['group_name']); + $this->assertEquals('not-me-active', $groups[4]['group_name']); } /** @@ -120,8 +120,8 @@ class CRM_Group_Page_AjaxTest extends CiviUnitTestCase { $this->setPermissionAndRequest(array('view all contacts', 'edit groups')); list($groups, $total) = CRM_Group_Page_AJAX::getGroupList(); $this->assertEquals(2, $total); - $this->assertEquals('pick-me-active', $groups[2]['title']); - $this->assertEquals('pick-me-disabled', $groups[1]['title']); + $this->assertEquals('pick-me-active', $groups[2]['group_name']); + $this->assertEquals('pick-me-disabled', $groups[1]['group_name']); } /** @@ -141,8 +141,8 @@ class CRM_Group_Page_AjaxTest extends CiviUnitTestCase { $this->setPermissionAndRequest(array('edit all contacts', 'edit groups')); list($groups, $total) = CRM_Group_Page_AJAX::getGroupList(); $this->assertEquals(2, $total); - $this->assertEquals('pick-me-active', $groups[2]['title']); - $this->assertEquals('not-me-active', $groups[4]['title']); + $this->assertEquals('pick-me-active', $groups[2]['group_name']); + $this->assertEquals('not-me-active', $groups[4]['group_name']); } /** @@ -153,8 +153,8 @@ class CRM_Group_Page_AjaxTest extends CiviUnitTestCase { $this->setPermissionAndRequest(array('view all contacts', 'edit groups')); list($groups, $total) = CRM_Group_Page_AJAX::getGroupList(); $this->assertEquals(2, $total); - $this->assertEquals('pick-me-active', $groups[2]['title']); - $this->assertEquals('not-me-active', $groups[4]['title']); + $this->assertEquals('pick-me-active', $groups[2]['group_name']); + $this->assertEquals('not-me-active', $groups[4]['group_name']); } /** @@ -165,8 +165,8 @@ class CRM_Group_Page_AjaxTest extends CiviUnitTestCase { $this->setPermissionAndRequest(array('view all contacts', 'edit groups')); list($groups, $total) = CRM_Group_Page_AJAX::getGroupList(); $this->assertEquals(2, $total); - $this->assertEquals('pick-me-disabled', $groups[1]['title']); - $this->assertEquals('not-me-disabled', $groups[3]['title']); + $this->assertEquals('pick-me-disabled', $groups[1]['group_name']); + $this->assertEquals('not-me-disabled', $groups[3]['group_name']); } /** @@ -178,7 +178,7 @@ class CRM_Group_Page_AjaxTest extends CiviUnitTestCase { $this->setPermissionAndRequest(array('view all contacts', 'edit groups')); list($groups, $total) = CRM_Group_Page_AJAX::getGroupList(); $this->assertEquals(1, $total); - $this->assertEquals('not-me-disabled', $groups[3]['title']); + $this->assertEquals('not-me-disabled', $groups[3]['group_name']); } /** @@ -190,7 +190,7 @@ class CRM_Group_Page_AjaxTest extends CiviUnitTestCase { $this->setPermissionAndRequest(array('view all contacts', 'edit groups')); list($groups, $total) = CRM_Group_Page_AJAX::getGroupList(); $this->assertEquals(1, $total); - $this->assertEquals('pick-me-disabled', $groups[1]['title']); + $this->assertEquals('pick-me-disabled', $groups[1]['group_name']); } /** @@ -201,10 +201,10 @@ class CRM_Group_Page_AjaxTest extends CiviUnitTestCase { $this->setPermissionAndRequest(array('view all contacts', 'edit groups')); list($groups, $total) = CRM_Group_Page_AJAX::getGroupList(); $this->assertEquals(4, $total); - $this->assertEquals('pick-me-disabled', $groups[1]['title']); - $this->assertEquals('not-me-disabled', $groups[3]['title']); - $this->assertEquals('pick-me-active', $groups[2]['title']); - $this->assertEquals('not-me-active', $groups[4]['title']); + $this->assertEquals('pick-me-disabled', $groups[1]['group_name']); + $this->assertEquals('not-me-disabled', $groups[3]['group_name']); + $this->assertEquals('pick-me-active', $groups[2]['group_name']); + $this->assertEquals('not-me-active', $groups[4]['group_name']); } @@ -281,7 +281,7 @@ class CRM_Group_Page_AjaxTest extends CiviUnitTestCase { list($groups, $total) = CRM_Group_Page_AJAX::getGroupList(); $this->assertEquals(1, count($groups), 'Returned groups should exclude disabled by default'); $this->assertEquals(1, $total, 'Total needs to be set correctly'); - $this->assertEquals('pick-me-active', $groups[2]['title']); + $this->assertEquals('pick-me-active', $groups[2]['group_name']); } public function testTraditionalACLNotFoundTitle() { @@ -300,8 +300,8 @@ class CRM_Group_Page_AjaxTest extends CiviUnitTestCase { list($groups, $total) = CRM_Group_Page_AJAX::getGroupList(); $this->assertEquals(2, count($groups), 'Returned groups should exclude disabled by default'); $this->assertEquals(2, $total, 'Total needs to be set correctly'); - $this->assertEquals('pick-me-active', $groups[2]['title']); - $this->assertEquals('pick-me-disabled', $groups[1]['title']); + $this->assertEquals('pick-me-active', $groups[2]['group_name']); + $this->assertEquals('pick-me-disabled', $groups[1]['group_name']); } public function testTraditionalACLDisabled() { @@ -311,7 +311,7 @@ class CRM_Group_Page_AjaxTest extends CiviUnitTestCase { list($groups, $total) = CRM_Group_Page_AJAX::getGroupList(); $this->assertEquals(1, count($groups), 'Returned groups should exclude disabled by default'); $this->assertEquals(1, $total, 'Total needs to be set correctly'); - $this->assertEquals('pick-me-disabled', $groups[1]['title']); + $this->assertEquals('pick-me-disabled', $groups[1]['group_name']); } public function testTraditionalACLDisabledFoundTitle() { @@ -322,7 +322,7 @@ class CRM_Group_Page_AjaxTest extends CiviUnitTestCase { list($groups, $total) = CRM_Group_Page_AJAX::getGroupList(); $this->assertEquals(1, count($groups), 'Returned groups should exclude disabled by default'); $this->assertEquals(1, $total, 'Total needs to be set correctly'); - $this->assertEquals('pick-me-disabled', $groups[1]['title']); + $this->assertEquals('pick-me-disabled', $groups[1]['group_name']); } public function testTraditionalACLDisabledNotFoundTitle() { @@ -342,7 +342,7 @@ class CRM_Group_Page_AjaxTest extends CiviUnitTestCase { list($groups, $total) = CRM_Group_Page_AJAX::getGroupList(); $this->assertEquals(1, count($groups), 'Returned groups should exclude disabled by default'); $this->assertEquals(1, $total, 'Total needs to be set correctly'); - $this->assertEquals('pick-me-active', $groups[2]['title']); + $this->assertEquals('pick-me-active', $groups[2]['group_name']); } public function testTraditionalACLAll() { @@ -352,8 +352,8 @@ class CRM_Group_Page_AjaxTest extends CiviUnitTestCase { list($groups, $total) = CRM_Group_Page_AJAX::getGroupList(); $this->assertEquals(2, count($groups), 'Returned groups should exclude disabled by default'); $this->assertEquals(2, $total, 'Total needs to be set correctly'); - $this->assertEquals('pick-me-active', $groups[2]['title']); - $this->assertEquals('pick-me-disabled', $groups[1]['title']); + $this->assertEquals('pick-me-active', $groups[2]['group_name']); + $this->assertEquals('pick-me-disabled', $groups[1]['group_name']); } /** @@ -365,7 +365,7 @@ class CRM_Group_Page_AjaxTest extends CiviUnitTestCase { list($groups, $total) = CRM_Group_Page_AJAX::getGroupList(); $this->assertEquals(1, count($groups), 'Returned groups should exclude disabled by default'); $this->assertEquals(1, $total, 'Total needs to be set correctly'); - $this->assertEquals('pick-me-disabled', $groups[1]['title']); + $this->assertEquals('pick-me-disabled', $groups[1]['group_name']); } /** @@ -378,7 +378,7 @@ class CRM_Group_Page_AjaxTest extends CiviUnitTestCase { list($groups, $total) = CRM_Group_Page_AJAX::getGroupList(); $this->assertEquals(1, count($groups), 'Returned groups should exclude disabled by default'); $this->assertEquals(1, $total, 'Total needs to be set correctly'); - $this->assertEquals('pick-me-disabled', $groups[1]['title']); + $this->assertEquals('pick-me-disabled', $groups[1]['group_name']); } /** @@ -402,7 +402,7 @@ class CRM_Group_Page_AjaxTest extends CiviUnitTestCase { list($groups, $total) = CRM_Group_Page_AJAX::getGroupList(); $this->assertEquals(1, count($groups), 'Returned groups should exclude disabled by default'); $this->assertEquals(1, $total, 'Total needs to be set correctly'); - $this->assertEquals('pick-me-active', $groups[2]['title']); + $this->assertEquals('pick-me-active', $groups[2]['group_name']); } /** @@ -425,8 +425,8 @@ class CRM_Group_Page_AjaxTest extends CiviUnitTestCase { list($groups, $total) = CRM_Group_Page_AJAX::getGroupList(); $this->assertEquals(2, count($groups), 'Returned groups should exclude disabled by default'); $this->assertEquals(2, $total, 'Total needs to be set correctly'); - $this->assertEquals('pick-me-active', $groups[2]['title']); - $this->assertEquals('pick-me-disabled', $groups[1]['title']); + $this->assertEquals('pick-me-active', $groups[2]['group_name']); + $this->assertEquals('pick-me-disabled', $groups[1]['group_name']); } /** @@ -438,8 +438,8 @@ class CRM_Group_Page_AjaxTest extends CiviUnitTestCase { list($groups, $total) = CRM_Group_Page_AJAX::getGroupList(); $this->assertEquals(2, count($groups), 'Returned groups should exclude disabled by default'); $this->assertEquals(2, $total, 'Total needs to be set correctly'); - $this->assertEquals('pick-me-active', $groups[2]['title']); - $this->assertEquals('pick-me-disabled', $groups[1]['title']); + $this->assertEquals('pick-me-active', $groups[2]['group_name']); + $this->assertEquals('pick-me-disabled', $groups[1]['group_name']); } /** @@ -451,7 +451,7 @@ class CRM_Group_Page_AjaxTest extends CiviUnitTestCase { list($groups, $total) = CRM_Group_Page_AJAX::getGroupList(); $this->assertEquals(1, count($groups), 'Returned groups should exclude disabled by default'); $this->assertEquals(1, $total, 'Total needs to be set correctly'); - $this->assertEquals('pick-me-active', $groups[2]['title']); + $this->assertEquals('pick-me-active', $groups[2]['group_name']); } /** -- 2.25.1