whitepace y, std is => array( on same line,
[civicrm-core.git] / CRM / Mailing / Form / Approve.php
index 5b8d7890600697c6b8c70fd6b6fd48943471126e..cd0fe402ddf2a3d4b50d1ef4ba33d0c1c089128b 100644 (file)
@@ -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);