From 1ff77353d85dfa60cc054192a4ff3745ae5fb880 Mon Sep 17 00:00:00 2001 From: Mathieu Lu Date: Tue, 23 Jan 2024 12:01:35 -0500 Subject: [PATCH] dev/core#4930 Fix Activity count when contact is assigned multiple roles --- CRM/Contact/BAO/Contact.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CRM/Contact/BAO/Contact.php b/CRM/Contact/BAO/Contact.php index 787d18f784..254d009eae 100644 --- a/CRM/Contact/BAO/Contact.php +++ b/CRM/Contact/BAO/Contact.php @@ -2633,9 +2633,11 @@ LEFT JOIN civicrm_email ON ( civicrm_contact.id = civicrm_email.contact_id ) case 'activity': return \Civi\Api4\Activity::get(TRUE) + ->selectRowCount() ->addJoin('ActivityContact AS activity_contact', 'INNER') ->addWhere('activity_contact.contact_id', '=', $contactId) ->addWhere('is_test', '=', FALSE) + ->addGroupBy('id') ->execute() ->count(); -- 2.25.1