Skip to content

Commit

Permalink
SearchKit - Fix smart group crash when ordering by aggregated column
Browse files Browse the repository at this point in the history
Fixes dev/report#68
  • Loading branch information
colemanw committed Jun 15, 2021
1 parent 01f7e22 commit 071788c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CRM/Contact/BAO/GroupContactCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,10 @@ protected static function getApiSQL(array $savedSearch, string $addSelect, strin
if (empty($apiParams['having'])) {
$apiParams['select'] = array_slice($apiParams['select'], 0, 1);
}
// Order is irrelevant unless using limit or offset
if (empty($apiParams['limit']) && empty($apiParams['offset'])) {
unset($apiParams['orderBy']);
}
/* @var $api \Civi\Api4\Generic\DAOGetAction */
$api = Request::create($savedSearch['api_entity'], 'get', $apiParams);
$query = new Api4SelectQuery($api);
Expand Down

0 comments on commit 071788c

Please sign in to comment.