CRM-12357 fixed redirection to wrong contact record
authorKurund Jalmi <kurund@civicrm.org>
Thu, 2 May 2013 00:47:21 +0000 (17:47 -0700)
committerKurund Jalmi <kurund@civicrm.org>
Thu, 2 May 2013 00:47:21 +0000 (17:47 -0700)
CRM/Activity/BAO/Activity.php
CRM/Mailing/BAO/Mailing.php

index 5867d148b38ee00653cda70cbe79621d6aeae1ed..b77628b9efe67fc2391ae6365f68383f138c4d48 100644 (file)
@@ -844,14 +844,12 @@ INNER JOIN {$activityContactTempTable} on {$activityTempTable}.activity_id = {$a
       }
       else {
         $values[$activityID]['recipients'] = ts('(recipients)');
-        $values[$activityID]['mailingId'] = '';
+        $values[$activityID]['mailingId'] = false;
         if (
           $accessCiviMail &&
           ($mailingIDs === TRUE || in_array($dao->source_record_id, $mailingIDs))
         ) {
-          $values[$activityID]['mailingId'] = CRM_Utils_System::url('civicrm/mailing/report',
-            "mid={$dao->source_record_id}&reset=1&cid={$dao->source_contact_id}&context=activitySelector"
-          );
+          $values[$activityID]['mailingId'] = true;
         }
       }
     }
@@ -2410,7 +2408,7 @@ INNER JOIN  civicrm_option_group grp ON ( grp.id = val.option_group_id AND grp.n
         }
 
         if (isset($values['mailingId']) && !empty($values['mailingId'])) {
-          $contactActivities[$activityId]['target_contact'] = CRM_Utils_System::href($values['recipients'], 'civicrm/mailing/report', "mid={$values['source_record_id']}&reset=1&cid={$values['source_contact_id']}&context=activitySelector");
+          $contactActivities[$activityId]['target_contact'] = CRM_Utils_System::href($values['recipients'], 'civicrm/mailing/report', "mid={$values['source_record_id']}&reset=1&cid={$params['contact_id']}&context=activitySelector");
         }
         elseif (CRM_Utils_Array::value('recipients', $values)) {
           $contactActivities[$activityId]['target_contact'] = $values['recipients'];
index cc3d38f62ed587cf81acbc8af59cb4ef77a975c2..86ffa343ce2995736212d1ad3383f703a018aba4 100644 (file)
@@ -2767,7 +2767,7 @@ AND        m.id = %1
       $contactMailings[$mailingId]['subject'] = $values['subject'];
       $contactMailings[$mailingId]['start_date'] = CRM_Utils_Date::customFormat($values['start_date']);
       $contactMailings[$mailingId]['recipients'] = CRM_Utils_System::href(ts('(recipients)'), 'civicrm/mailing/report/event',
-        "mid={$values['mailing_id']}&reset=1&cid={$values['creator_id']}&event=delivered&context=mailing");
+        "mid={$values['mailing_id']}&reset=1&cid={$params['contact_id']}&event=delivered&context=mailing");
       $contactMailings[$mailingId]['mailing_creator'] = CRM_Utils_System::href(
           $values['creator_name'],
           'civicrm/contact/view',
@@ -2793,7 +2793,7 @@ AND        m.id = %1
         CRM_Core_Action::BROWSE => array(
           'name' => ts('Mailing Report'),
           'url' => 'civicrm/mailing/report',
-          'qs' => "mid={$values['mailing_id']}&reset=1&cid={$values['creator_id']}&context=mailing",
+          'qs' => "mid={$values['mailing_id']}&reset=1&cid={$params['contact_id']}&context=mailing",
           'title' => ts('View Mailing Report'),
         )
       );