From 8a13a74562f82a8df42203b8c8d306d28c14b340 Mon Sep 17 00:00:00 2001 From: kurund Date: Mon, 30 Dec 2013 21:56:09 -0800 Subject: [PATCH] fixes for CRM-14004, duplicate memberships ---------------------------------------- * CRM-14004: Membership export includes multiple copies of the same membership http://issues.civicrm.org/jira/browse/CRM-14004 --- CRM/Export/BAO/Export.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/CRM/Export/BAO/Export.php b/CRM/Export/BAO/Export.php index 1fa49ff04c..c51dc1ffca 100644 --- a/CRM/Export/BAO/Export.php +++ b/CRM/Export/BAO/Export.php @@ -561,6 +561,20 @@ INSERT INTO {$componentTable} SELECT distinct gc.contact_id FROM civicrm_group_c $groupBy = " GROUP BY contact_a.id"; } + switch ($exportMode) { + case CRM_Export_Form_Select::CONTRIBUTE_EXPORT: + $groupBy = 'GROUP BY civicrm_contribution.id'; + break; + + case CRM_Export_Form_Select::EVENT_EXPORT: + $groupBy = 'GROUP BY civicrm_participant.id'; + break; + + case CRM_Export_Form_Select::MEMBER_EXPORT: + $groupBy = " GROUP BY civicrm_membership.id"; + break; + } + if ($queryMode & CRM_Contact_BAO_Query::MODE_ACTIVITY) { $groupBy = " GROUP BY civicrm_activity.id "; } -- 2.25.1