INFRA-132 - CRM/Contribute - phpcbf
[civicrm-core.git] / CRM / Contribute / Form / SoftCredit.php
index f725f951797b4d688b1726eee82a64483e92f295..666c37582b2494eed49a3fad7ab235f7ff77aca6 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.5                                                |
+ | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
 class CRM_Contribute_Form_SoftCredit {
 
   /**
-   * Function to set variables up before form is built
+   * Set variables up before form is built
    *
-   * @param $form
+   * @param CRM_Core_Form $form
    *
    * @return void
-   * @access static
    */
-  static function preProcess(&$form) {
+  public static function preProcess(&$form) {
     $contriDAO = new CRM_Contribute_DAO_Contribution();
     $contriDAO->id = $form->_id;
     $contriDAO->find(TRUE);
@@ -71,11 +70,10 @@ class CRM_Contribute_Form_SoftCredit {
    * Function used to build form element for soft credit block
    *
    * @param CRM_Core_Form $form
-   * @access public
    *
    * @return void
    */
-  static function buildQuickForm(&$form) {
+  public static function buildQuickForm(&$form) {
     if ($form->_mode == 'live' && !empty($form->_honor_block_is_active)) {
       $ufJoinDAO = new CRM_Core_DAO_UFJoin();
       $ufJoinDAO->module = 'soft_credit';
@@ -96,7 +94,7 @@ class CRM_Contribute_Form_SoftCredit {
           $form->addGroup($honorTypes, 'soft_credit_type_id', NULL)->setAttribute('allowClear', TRUE);
         }
       }
-        return $form;
+      return $form;
     }
 
     // by default generate 5 blocks
@@ -106,7 +104,7 @@ class CRM_Contribute_Form_SoftCredit {
     if ($form->getAction() & CRM_Core_Action::UPDATE) {
       $form->_softCreditInfo = CRM_Contribute_BAO_ContributionSoft::getSoftContribution($form->_id, TRUE);
     }
-    elseif (property_exists($form, "_pledgeID")) {
+    elseif (!empty($form->_pledgeID)) {
       //Check and select most recent completed contrubtion and use it to retrieve
       //soft-credit information to use as default for current pledge payment, CRM-13981
       $pledgePayments = CRM_Pledge_BAO_PledgePayment::getPledgePayments($form->_pledgeID);
@@ -159,8 +157,11 @@ class CRM_Contribute_Form_SoftCredit {
 
   /**
    * Function used to set defaults for soft credit block
+   *
+   * @param $defaults
+   * @param $form
    */
-  static function setDefaultValues(&$defaults, &$form) {
+  public static function setDefaultValues(&$defaults, &$form) {
     //Used to hide/unhide PCP and/or Soft-credit Panes
     $noPCP = $noSoftCredit = TRUE;
     if (!empty($form->_softCreditInfo['soft_credit'])) {
@@ -189,18 +190,18 @@ class CRM_Contribute_Form_SoftCredit {
   }
 
   /**
-   * global form rule
+   * Global form rule
    *
-   * @param array $fields the input form values
+   * @param array $fields
+   *   The input form values.
    *
    * @param $errors
    * @param $self
    *
    * @return array of errors
-   * @access public
    * @static
    */
-  static function formRule($fields, $errors, $self) {
+  public static function formRule($fields, $errors, $self) {
     $errors = array();
 
     // if honor roll fields are populated but no PCP is selected
@@ -237,4 +238,3 @@ class CRM_Contribute_Form_SoftCredit {
     return $errors;
   }
 }
-