From 14e99c8f9662437afc41b7dd3e03ebd366f9c55a Mon Sep 17 00:00:00 2001 From: Karin Gerritsen Date: Tue, 2 Jun 2015 19:23:43 -0600 Subject: [PATCH] Update Recur.php - add AND email is_primary = 1 to avoid duplicate results for contacts who have multiple email addresses in their contact record. --- CRM/Report/Form/Contribute/Recur.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CRM/Report/Form/Contribute/Recur.php b/CRM/Report/Form/Contribute/Recur.php index 5b0f8afc59..c2278f0d97 100644 --- a/CRM/Report/Form/Contribute/Recur.php +++ b/CRM/Report/Form/Contribute/Recur.php @@ -234,11 +234,12 @@ class CRM_Report_Form_Contribute_Recur extends CRM_Report_Form { ON {$this->_aliases['civicrm_contribution_recur']}.id = {$this->_aliases['civicrm_contribution']}.contribution_recur_id"; $this->_from .= " LEFT JOIN civicrm_email {$this->_aliases['civicrm_email']} - ON {$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_email']}.contact_id"; + ON ({$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_email']}.contact_id AND + {$this->_aliases['civicrm_email']}.is_primary = 1)"; $this->_from .= " LEFT JOIN civicrm_phone {$this->_aliases['civicrm_phone']} ON ({$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_phone']}.contact_id AND - {$this->_aliases['civicrm_phone']}.is_primary = 1)"; + {$this->_aliases['civicrm_phone']}.is_primary = 1)"; } public function groupBy() { -- 2.25.1