Merge remote-tracking branch 'upstream/4.5' into 4.5-master-2015-03-03-23-44-14
[civicrm-core.git] / CRM / PCP / Form / Contribute.php
index 1e950dd71c53963bda1963023403d0d8d459999b..65e4e53734362245fd4f911a8403673d41454a61 100644 (file)
@@ -23,7 +23,7 @@
  | GNU Affero General Public License or the licensing of CiviCRM,     |
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
-*/
+ */
 
 /**
  *
@@ -74,6 +74,7 @@ class CRM_PCP_Form_Contribute extends CRM_Contribute_Form_ContributionPage {
       $defaults['is_tellfriend_enabled'] = 1;
       $defaults['tellfriend_limit'] = 5;
       $defaults['link_text'] = ts('Create your own fundraising page');
+      $defaults['owner_notify_id'] = CRM_Core_OptionGroup::getDefaultValue('pcp_owner_notify');
 
       if ($ccReceipt = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $this->_id, 'cc_receipt')) {
         $defaults['notify_email'] = $ccReceipt;
@@ -83,11 +84,12 @@ class CRM_PCP_Form_Contribute extends CRM_Contribute_Form_ContributionPage {
   }
 
   /**
-   * Build the form object
+   * Build the form object.
    *
    * @return void
    */
   public function buildQuickForm() {
+    $this->_last = TRUE;
     CRM_PCP_BAO_PCP::buildPCPForm($this);
 
     $this->addElement('checkbox', 'pcp_active', ts('Enable Personal Campaign Pages? (for this contribution page)'), NULL, array('onclick' => "return showHideByValue('pcp_active',true,'pcpFields','table-row','radio',false);"));
@@ -97,7 +99,7 @@ class CRM_PCP_Form_Contribute extends CRM_Contribute_Form_ContributionPage {
   }
 
   /**
-   * Validation
+   * Validation.
    *
    * @param array $params
    *   (ref.) an assoc array of name/value pairs.
@@ -105,8 +107,8 @@ class CRM_PCP_Form_Contribute extends CRM_Contribute_Form_ContributionPage {
    * @param $files
    * @param $self
    *
-   * @return mixed true or array of errors
-   * @static
+   * @return bool|array
+   *   mixed true or array of errors
    */
   public static function formRule($params, $files, $self) {
     $errors = array();
@@ -139,7 +141,7 @@ class CRM_PCP_Form_Contribute extends CRM_Contribute_Form_ContributionPage {
   }
 
   /**
-   * Process the form submission
+   * Process the form submission.
    *
    *
    * @return void
@@ -178,4 +180,5 @@ class CRM_PCP_Form_Contribute extends CRM_Contribute_Form_ContributionPage {
   public function getTitle() {
     return ts('Enable Personal Campaign Pages');
   }
+
 }