Merge branch '4.5' into 4.6
[civicrm-core.git] / CRM / Batch / Form / Entry.php
index 165ec1114d0554b3272329840c3c5c13d412129a..ec48e66409a10a2228663069eb7c70eba07078c5 100755 (executable)
 class CRM_Batch_Form_Entry extends CRM_Core_Form {
 
   /**
-   * Maximum profile fields that will be displayed
+   * Maximum profile fields that will be displayed.
    */
   protected $_rowCount = 1;
 
   /**
-   * Batch id
+   * Batch id.
    */
   protected $_batchId;
 
   /**
-   * Batch information
+   * Batch information.
    */
   protected $_batchInfo = array();
 
   /**
-   * Store the profile id associated with the batch type
+   * Store the profile id associated with the batch type.
    */
   protected $_profileId;
 
@@ -66,17 +66,17 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {
 
   public $_membershipId = NULL;
   /**
-   * When not to reset sort_name
+   * When not to reset sort_name.
    */
   protected $_preserveDefault = TRUE;
 
   /**
-   * Contact fields
+   * Contact fields.
    */
   protected $_contactFields = array();
 
   /**
-   * Fields array of fields in the batch profile
+   * Fields array of fields in the batch profile.
    * (based on the uf_field table data)
    * (this can't be protected as it is passed into the CRM_Contact_Form_Task_Batch::parseStreetAddress function
    * (although a future refactoring might hopefully change that so it uses the api & the function is not
@@ -86,7 +86,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {
   public $_fields = array();
 
   /**
-   * Build all the data structures needed to build the form
+   * Build all the data structures needed to build the form.
    *
    * @return void
    */
@@ -114,7 +114,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {
   }
 
   /**
-   * Build the form object
+   * Build the form object.
    *
    *
    * @return void
@@ -202,7 +202,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {
     for ($rowNumber = 1; $rowNumber <= $this->_batchInfo['item_count']; $rowNumber++) {
       $this->addEntityRef("primary_contact_id[{$rowNumber}]", '', array(
           'create' => TRUE,
-          'placeholder' => ts('- select -')
+          'placeholder' => ts('- select -'),
         ));
 
       // special field specific to membership batch udpate
@@ -253,7 +253,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {
         'contact' => array(
           'return' => implode(',', $contactReturnProperties),
           'fieldmap' => array_flip($contactReturnProperties),
-        )
+        ),
       ));
 
     // don't set the status message when form is submitted.
@@ -265,7 +265,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {
   }
 
   /**
-   * Form validations
+   * Form validations.
    *
    * @param array $params
    *   Posted values of the form.
@@ -276,7 +276,6 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {
    *
    * @return array
    *   list of errors to be posted back to the form
-   * @static
    */
   public static function formRule($params, $files, $self) {
     $errors = array();
@@ -329,7 +328,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {
   }
 
   /**
-   * Override default cancel action
+   * Override default cancel action.
    */
   public function cancelAction() {
     // redirect to batch listing
@@ -379,7 +378,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {
   }
 
   /**
-   * Process the form after the input has been submitted and validated
+   * Process the form after the input has been submitted and validated.
    *
    *
    * @return void
@@ -414,7 +413,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {
   }
 
   /**
-   * Process contribution records
+   * Process contribution records.
    *
    * @param array $params
    *   Associated array of submitted values.
@@ -584,7 +583,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {
   }
 
   /**
-   * Process membership records
+   * Process membership records.
    *
    * @param array $params
    *   Associated array of submitted values.
@@ -781,7 +780,8 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {
           );
 
           // make contribution entry
-          CRM_Member_BAO_Membership::recordMembershipContribution(array_merge($value, array('membership_id' => $membership->id)));
+          $contrbutionParams = array_merge($value, array('membership_id' => $membership->id));
+          CRM_Member_BAO_Membership::recordMembershipContribution($contrbutionParams);
         }
         else {
           $membership = CRM_Member_BAO_Membership::create($value, CRM_Core_DAO::$_nullArray);
@@ -827,7 +827,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {
   }
 
   /**
-   * Update contact information
+   * Update contact information.
    *
    * @param array $value
    *   Associated array of submitted values.
@@ -871,4 +871,5 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {
   public function testProcessContribution($params) {
     return $this->processContribution($params);
   }
+
 }