whitepace y, std is => array( on same line,
[civicrm-core.git] / CRM / Mailing / Form / Approve.php
index 00bb54cd4ad324d9bb0fe9c5809434beb5f7a060..cd0fe402ddf2a3d4b50d1ef4ba33d0c1c089128b 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 /*
   +--------------------------------------------------------------------+
-  | CiviCRM version 4.4                                                |
+  | CiviCRM version 4.5                                                |
   +--------------------------------------------------------------------+
-  | Copyright CiviCRM LLC (c) 2004-2013                                |
+  | Copyright CiviCRM LLC (c) 2004-2014                                |
   +--------------------------------------------------------------------+
   | This file is a part of CiviCRM.                                    |
   |                                                                    |
@@ -28,7 +28,7 @@
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
  * $Id$
  *
  */
@@ -44,7 +44,7 @@ class CRM_Mailing_Form_Approve extends CRM_Core_Form {
   }
 
   /**
-   * Function to set variables up before form is built
+   * Set variables up before form is built
    *
    * @return void
    * @access public
@@ -82,7 +82,7 @@ class CRM_Mailing_Form_Approve extends CRM_Core_Form {
   }
 
   /**
-   * This function sets the default values for the form.
+   * Set default values for the form.
    *
    * @access public
    *
@@ -99,7 +99,7 @@ class CRM_Mailing_Form_Approve extends CRM_Core_Form {
   }
 
   /**
-   * Build the form for the approval/rejection mailing
+   * Build the form object for the approval/rejection mailing
    *
    * @param
    *
@@ -146,7 +146,13 @@ class CRM_Mailing_Form_Approve extends CRM_Core_Form {
       $this->_mailingID,
       'subject'
     );
-    $preview['viewURL'] = CRM_Utils_System::url('civicrm/mailing/view', "reset=1&id={$this->_mailingID}");
+
+    $mailingKey = $this->_mailingID;
+    if ($hash = CRM_Mailing_BAO_Mailing::getMailingHash($mailingKey)) {
+      $mailingKey = $hash;
+    }
+
+    $preview['viewURL'] = CRM_Utils_System::url('civicrm/mailing/view', "reset=1&id={$mailingKey}");
     $preview['type'] = $this->_mailing->body_html ? 'html' : 'text';
     $preview['attachment'] = CRM_Core_BAO_File::attachmentInfo('civicrm_mailing', $this->_mailingID);