From 00b7067b93a40828fb2b9572acfb9c11e7970fa3 Mon Sep 17 00:00:00 2001 From: Jon Goldberg Date: Thu, 30 Nov 2023 13:09:26 -0500 Subject: [PATCH] Activity case filter speedup --- api/v3/Activity.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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])) { -- 2.25.1