From 13b96c8bee7484e98ad1237cfa71a75797a68668 Mon Sep 17 00:00:00 2001 From: Jamie McClelland Date: Mon, 29 Mar 2021 10:27:25 -0400 Subject: [PATCH] Only include completed contributions in the aggregate custom search There is little value in getting the aggregate contributions if failed contributions are also included. --- CRM/Contact/Form/Search/Custom/ContributionAggregate.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CRM/Contact/Form/Search/Custom/ContributionAggregate.php b/CRM/Contact/Form/Search/Custom/ContributionAggregate.php index 89f0be3feb..2d95568eeb 100644 --- a/CRM/Contact/Form/Search/Custom/ContributionAggregate.php +++ b/CRM/Contact/Form/Search/Custom/ContributionAggregate.php @@ -194,9 +194,11 @@ civicrm_contact AS contact_a {$this->_aclFrom} * @return string */ public function where($includeContactIDs = FALSE) { + $contributionCompletedStatusId = CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_Contribution', 'contribution_status_id', 'Completed'); $clauses = [ "contrib.contact_id = contact_a.id", "contrib.is_test = 0", + "contrib.contribution_status_id = " . intval($contributionCompletedStatusId), ]; foreach ([ -- 2.25.1