From: Mathieu Lu Date: Tue, 23 Jan 2024 17:01:35 +0000 (-0500) Subject: dev/core#4930 Fix Activity count when contact is assigned multiple roles X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=1ff77353d85dfa60cc054192a4ff3745ae5fb880;p=civicrm-core.git dev/core#4930 Fix Activity count when contact is assigned multiple roles --- 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();