dev/core#4930 Fix Activity count when contact is assigned multiple roles
authorMathieu Lu <mathieu@symbiotic.coop>
Tue, 23 Jan 2024 17:01:35 +0000 (12:01 -0500)
committerMathieu Lutfy <mathieu@bidon.ca>
Tue, 23 Jan 2024 21:16:07 +0000 (16:16 -0500)
CRM/Contact/BAO/Contact.php

index 787d18f78474a7bc42f4466cd8b28ac85623c3d5..254d009eae5c9dee69b46eacaea5201c346cfa58 100644 (file)
@@ -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();