more clean up (CRM-12697)
authoryashodha <yashodha.chaku@webaccess.co.in>
Wed, 29 May 2013 09:45:35 +0000 (15:15 +0530)
committeryashodha <yashodha.chaku@webaccess.co.in>
Wed, 29 May 2013 09:45:35 +0000 (15:15 +0530)
CRM/Activity/Form/Task/SearchTaskHookSample.php
CRM/Activity/Selector/Search.php

index 25962a414bc9f6847f71b0a2e19bd4ec47e77123..69131428f9c54eea4a93e4ad10b4437519f5c9e6 100644 (file)
@@ -49,13 +49,17 @@ class CRM_Activity_Form_Task_SearchTaskHookSample extends CRM_Activity_Form_Task
     $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 )";
index eb0d95199110e3b1a13c1449ea14031a261f9129..81a5d9bd79af2632666f475267b759c2b62a0a70 100644 (file)
@@ -300,7 +300,7 @@ class CRM_Activity_Selector_Search extends CRM_Core_Selector_Base implements CRM
         ($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'] = '';