From: Jon Goldberg Date: Thu, 30 Nov 2023 18:09:26 +0000 (-0500) Subject: Activity case filter speedup X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=00b7067b93a40828fb2b9572acfb9c11e7970fa3;p=civicrm-core.git Activity case filter speedup --- diff --git a/api/v3/Activity.php b/api/v3/Activity.php index 617d6f5a38..597732a9ea 100644 --- a/api/v3/Activity.php +++ b/api/v3/Activity.php @@ -336,12 +336,14 @@ function _civicrm_api3_activity_get_extraFilters(&$params, &$sql) { 'join' => '!joinType civicrm_entity_file !alias ON (!alias.entity_table = "civicrm_activity" AND !alias.entity_id = a.id)', 'column' => 'file_id', ], - 'case_id' => [ + ]; + if (\CRM_Core_Component::isEnabled('CiviCase')) { + $rels['case_id'] = [ 'subquery' => 'a.id IN (SELECT activity_id FROM civicrm_case_activity WHERE !clause)', 'join' => '!joinType civicrm_case_activity !alias ON (!alias.activity_id = a.id)', 'column' => 'case_id', - ], - ]; + ]; + } foreach ($rels as $filter => $relSpec) { if (!empty($params[$filter])) { if (!is_array($params[$filter])) {