Merge pull request #3316 from davecivicrm/commentAndDropdownFix
[civicrm-core.git] / CRM / Member / Form.php
index 84cb93d63b000484a7c0791f76ce0f5b552086a1..749bb46ebcc40cd7aa9cf941254259769b0024f4 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.3                                                |
+ | 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$
  *
  */
@@ -64,7 +64,7 @@ class CRM_Member_Form extends CRM_Core_Form {
    *
    * @access public
    *
-   * @return None
+   * @return array defaults
    */
   function setDefaultValues() {
     $defaults = array();
@@ -100,7 +100,7 @@ class CRM_Member_Form extends CRM_Core_Form {
   /**
    * Function to actually build the form
    *
-   * @return None
+   * @return void
    * @access public
    */
   public function buildQuickForm() {
@@ -168,13 +168,16 @@ class CRM_Member_Form extends CRM_Core_Form {
    * then they weill differ
    *
    * @param $formValues array values from form. The important values we are looking for are
-   *  - contact_select_id[1]
-   *  - contribution_contact_select_id[1]
+   *  - contact_id
+   *  - soft_credit_contact_id
+   */
+  /**
+   * @param $formValues
    */
   function storeContactFields($formValues){
     // in a 'standalone form' (contact id not in the url) the contact will be in the form values
-    if (CRM_Utils_Array::value('contact_select_id', $formValues)) {
-      $this->_contactID = $formValues['contact_select_id'][1];
+    if (!empty($formValues['contact_id'])) {
+      $this->_contactID = $formValues['contact_id'];
     }
 
     list($this->_memberDisplayName,
@@ -183,8 +186,8 @@ class CRM_Member_Form extends CRM_Core_Form {
 
     //CRM-10375 Where the payer differs to the member the payer should get the email.
     // here we store details in order to do that
-    if (CRM_Utils_Array::value('contribution_contact_select_id', $formValues) && CRM_Utils_Array::value('1', $formValues['contribution_contact_select_id'])) {
-      $this->_receiptContactId = $this->_contributorContactID = $formValues['contribution_contact_select_id'][1];
+    if (!empty($formValues['soft_credit_contact_id'])) {
+      $this->_receiptContactId = $this->_contributorContactID = $formValues['soft_credit_contact_id'];
        list( $this->_contributorDisplayName,
          $this->_contributorEmail ) = CRM_Contact_BAO_Contact_Location::getEmailDetails( $this->_contributorContactID );
     }