From d977e22111e7cb6c02131fe0e924f389456f951f Mon Sep 17 00:00:00 2001 From: Andrew Hunt Date: Tue, 6 Dec 2016 17:31:34 -0500 Subject: [PATCH] CRM-19725 CiviContribute: exclude donor from potential honoree dedupe matches --- CRM/Contribute/BAO/ContributionSoft.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CRM/Contribute/BAO/ContributionSoft.php b/CRM/Contribute/BAO/ContributionSoft.php index 5d835e9570..8e61da78bf 100644 --- a/CRM/Contribute/BAO/ContributionSoft.php +++ b/CRM/Contribute/BAO/ContributionSoft.php @@ -155,7 +155,13 @@ class CRM_Contribute_BAO_ContributionSoft extends CRM_Contribute_DAO_Contributio $profileContactType = CRM_Core_BAO_UFGroup::getContactType($form->_values['honoree_profile_id']); $dedupeParams = CRM_Dedupe_Finder::formatParams($params['honor'], $profileContactType); $dedupeParams['check_permission'] = FALSE; - $ids = CRM_Dedupe_Finder::dupesByParams($dedupeParams, $profileContactType); + // honoree should never be the donor + $exceptKeys = array( + 'contactID' => 0, + 'onbehalf_contact_id' => 0, + ); + $except = array_values(array_intersect_key($params, $exceptKeys)); + $ids = CRM_Dedupe_Finder::dupesByParams($dedupeParams, $profileContactType, 'Unsupervised', $except); if (count($ids)) { $honorId = CRM_Utils_Array::value(0, $ids); } -- 2.25.1