From b4eac1e9e90e4d9a51f76db799184dc4db5c4722 Mon Sep 17 00:00:00 2001 From: yashodha Date: Wed, 29 May 2013 11:30:28 +0530 Subject: [PATCH] CRM-12697 --- CRM/Export/BAO/Export.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/CRM/Export/BAO/Export.php b/CRM/Export/BAO/Export.php index 58210777b8..1c03b59303 100644 --- a/CRM/Export/BAO/Export.php +++ b/CRM/Export/BAO/Export.php @@ -455,11 +455,14 @@ INSERT INTO {$componentTable} SELECT distinct gc.contact_id FROM civicrm_group_c $relIDs = $ids; } elseif ($exportMode == CRM_Export_Form_Select::ACTIVITY_EXPORT) { - $query = "SELECT source_contact_id FROM civicrm_activity - WHERE id IN ( " . implode(',', $ids) . ")"; + $activityContacts = CRM_Core_PseudoConstant::activityContacts('name'); + $sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts); + $query = "SELECT contact_id FROM civicrm_activity_contact + WHERE activity_id IN ( " . implode(',', $ids) . ") AND + record_type_id = {$sourceID}"; $dao = CRM_Core_DAO::executeQuery($query); while ($dao->fetch()) { - $relIDs[] = $dao->source_contact_id; + $relIDs[] = $dao->contact_id; } } else { -- 2.25.1