$rows = array();
// display name and activity details of all selected contacts
$activityIDs = implode(',', $this->_activityHolderIds);
+
+ $activityContacts = CRM_Core_PseudoConstant::activityContacts('name');
+ $sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts);
$query = "
SELECT at.subject as subject,
ov.label as activity_type,
at.activity_date_time as activity_date,
ct.display_name as display_name
FROM civicrm_activity at
-INNER JOIN civicrm_contact ct ON ( at.source_contact_id = ct.id )
+LEFT JOIN civicrm_activity_contact ac ON ( ac.activity_id = at.id AND ac.record_type_id = {$sourceID} )
+INNER JOIN civicrm_contact ct ON ( ac.contact_id = ct.id )
LEFT JOIN civicrm_option_group og ON ( og.name = 'activity_type' )
LEFT JOIN civicrm_option_value ov ON (at.activity_type_id = ov.value AND og.id = ov.option_group_id )
WHERE at.id IN ( $activityIDs )";
($bulkActivityTypeID == $activityTypeId)
) {
$row['mailingId'] = CRM_Utils_System::url('civicrm/mailing/report',
- "mid={$result->source_record_id}&reset=1&cid={$result->source_contact_id}&context=activitySelector"
+ "mid={$result->source_record_id}&reset=1&cid={$contactId}&context=activitySelector"
);
$row['recipients'] = ts('(recipients)');
$row['target_contact_name'] = '';