Merge pull request #4657 from monishdeb/CRM-14512
[civicrm-core.git] / CRM / Mailing / Form / Settings.php
index 15b58f17425d8cc4cd0ba25ccd0494eabeb95da6..f9d5df16b38f902865d8d307f291ad8d6aeff03c 100644 (file)
@@ -39,7 +39,7 @@
 class CRM_Mailing_Form_Settings extends CRM_Core_Form {
 
   /**
-   * Function to set variables up before form is built
+   * Set variables up before form is built
    *
    * @return void
    * @access public
@@ -57,7 +57,7 @@ class CRM_Mailing_Form_Settings extends CRM_Core_Form {
   }
 
   /**
-   * This function sets the default values for the form.
+   * Set default values for the form.
    * the default values are retrieved from the database
    *
    * @access public
@@ -66,6 +66,10 @@ class CRM_Mailing_Form_Settings extends CRM_Core_Form {
    */
   function setDefaultValues() {
     $mailingID = CRM_Utils_Request::retrieve('mid', 'Integer', $this, FALSE, NULL);
+    // CRM-14716 - Pick up mailingID from session since most of the time it's not in the URL
+    if (!$mailingID) {
+      $mailingID = $this->get('mailing_id');
+    }
     $count = $this->get('count');
     $this->assign('count', $count);
     $defaults = array();
@@ -92,11 +96,12 @@ class CRM_Mailing_Form_Settings extends CRM_Core_Form {
       $dao->storeValues($dao, $defaults);
       $defaults['visibility'] = $dao->visibility;
     }
+
     return $defaults;
   }
 
   /**
-   * Function to actually build the form
+   * Build the form object
    *
    * @return void
    * @access public