$clauses[] = '`groups`.parents IS NULL';
}
- $savedSearch = CRM_Utils_Array::value('savedSearch', $params);
+ $savedSearch = $params['savedSearch'] ?? NULL;
if ($savedSearch == 1) {
- $clauses[] = 'groups.saved_search_id IS NOT NULL';
+ $clauses[] = '`groups`.saved_search_id IS NOT NULL';
}
elseif ($savedSearch == 2) {
- $clauses[] = 'groups.saved_search_id IS NULL';
+ $clauses[] = '`groups`.saved_search_id IS NULL';
}
// only show child groups of a specific parent group
}
$this->assertEquals(1, $groups['recordsTotal']);
$this->assertEquals('not-me-active', $groups['data'][0]['title']);
+ // Search on just smart groups keeping the title filter
+ $_GET['savedSearch'] = 1;
+ try {
+ CRM_Group_Page_AJAX::getGroupList();
+ }
+ catch (CRM_Core_Exception_PrematureExitException $e) {
+ $groups = $e->errorData;
+ }
+ $this->assertEquals(0, $groups['recordsTotal']);
+ // Now search on just normal groups keeping the title filter
+ $_GET['savedSearch'] = 2;
+ try {
+ CRM_Group_Page_AJAX::getGroupList();
+ }
+ catch (CRM_Core_Exception_PrematureExitException $e) {
+ $groups = $e->errorData;
+ }
+ $this->assertEquals(1, $groups['recordsTotal']);
+ $this->assertEquals('not-me-active', $groups['data'][0]['title']);
unset($_GET['title']);
+ unset($_GET['savedSearch']);
// check on status
$_GET['status'] = 2;