worked on CRM-12357, fixed redirecting back to correct page
authorKurund Jalmi <kurund@civicrm.org>
Wed, 1 May 2013 20:17:36 +0000 (13:17 -0700)
committerKurund Jalmi <kurund@civicrm.org>
Wed, 1 May 2013 20:17:36 +0000 (13:17 -0700)
CRM/Mailing/Page/Event.php
templates/CRM/Mailing/Page/Event.tpl

index 749806db20b51b9662230d4fb1c9ba2a939b42b8..201924a3a4bee8923224ab7078e1648fdf8caa8d 100644 (file)
@@ -65,6 +65,22 @@ class CRM_Mailing_Page_Event extends CRM_Core_Page {
 
     $mailing_id = CRM_Utils_Request::retrieve('mid', 'Positive', $this);
 
+    //assign backurl
+    $context = CRM_Utils_Request::retrieve('context', 'String', $this);
+
+    if ($context == 'mailing') {
+      $cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
+      $backUrl = CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$cid}&selectedChild=mailing");
+      $backUrlTitle = ts('Back to Mailing');
+    }
+    else {
+      $backUrl = CRM_Utils_System::url('civicrm/mailing', 'reset=1');
+      $backUrlTitle = ts('Back to Report');
+    }
+
+    $this->assign('backUrl', $backUrl);
+    $this->assign('backUrlTitle', $backUrlTitle);
+
     CRM_Utils_System::setTitle($selector->getTitle());
     $this->assign('title', $selector->getTitle());
     $this->assign('mailing_id', $mailing_id);
index 7cee9f58e6e820c595b88b61efa5cd01b97868cb..93d7a54b6bd9649b3ac1adc666b544ef3a4a7045 100644 (file)
@@ -62,7 +62,7 @@
 {/if}
 
 <div class="action-link">
-  <a href="{crmURL p='civicrm/mailing/report' q="mid=`$mailing_id`&reset=1"}">&raquo; {ts}Back to Report{/ts}</a>
+  <a href="{$backUrl}">&raquo; {$backUrlTitle}</a>
 </div>
 
 {include file="CRM/common/pager.tpl" location="bottom"}