Merge pull request #4899 from colemanw/INFRA-132
[civicrm-core.git] / CRM / Financial / BAO / FinancialAccount.php
index 9a163c5c0344360f0cad7682cda7462476515065..8af62276999e9622ce25ab8728b033bf8ef03f5d 100644 (file)
@@ -33,7 +33,6 @@
  * $Id$
  *
  */
-
 class CRM_Financial_BAO_FinancialAccount extends CRM_Financial_DAO_FinancialAccount {
 
   /**
@@ -51,10 +50,12 @@ class CRM_Financial_BAO_FinancialAccount extends CRM_Financial_DAO_FinancialAcco
   /**
    * Fetch object based on array of properties
    *
-   * @param array $params   (reference ) an assoc array of name/value pairs
-   * @param array $defaults (reference ) an assoc array to hold the flattened values
+   * @param array $params
+   *   (reference ) an assoc array of name/value pairs.
+   * @param array $defaults
+   *   (reference ) an assoc array to hold the flattened values.
    *
-   * @return CRM_Contribute_BAO_FinancialAccount object
+   * @return CRM_Financial_BAO_FinancialAccount
    * @static
    */
   public static function retrieve(&$params, &$defaults) {
@@ -70,10 +71,13 @@ class CRM_Financial_BAO_FinancialAccount extends CRM_Financial_DAO_FinancialAcco
   /**
    * Update the is_active flag in the db
    *
-   * @param int      $id        id of the database record
-   * @param boolean  $is_active value we want to set the is_active field
+   * @param int $id
+   *   Id of the database record.
+   * @param bool $is_active
+   *   Value we want to set the is_active field.
    *
-   * @return Object             DAO object on sucess, null otherwise
+   * @return CRM_Core_DAO|null
+   *   DAO object on success, null otherwise
    * @static
    */
   public static function setIsActive($id, $is_active) {
@@ -83,14 +87,16 @@ class CRM_Financial_BAO_FinancialAccount extends CRM_Financial_DAO_FinancialAcco
   /**
    * Add the financial types
    *
-   * @param array $params reference array contains the values submitted by the form
-   * @param array $ids    reference array contains the id
+   * @param array $params
+   *   Reference array contains the values submitted by the form.
+   * @param array $ids
+   *   Reference array contains the id.
    *
    * @static
-   * @return object
+   * @return CRM_Financial_DAO_FinancialAccount
    */
   public static function add(&$params, &$ids = array()) {
-    if(empty($params['id'])) {
+    if (empty($params['id'])) {
       $params['is_active'] = CRM_Utils_Array::value('is_active', $params, FALSE);
       $params['is_deductible'] = CRM_Utils_Array::value('is_deductible', $params, FALSE);
       $params['is_tax'] = CRM_Utils_Array::value('is_tax', $params, FALSE);
@@ -127,9 +133,9 @@ class CRM_Financial_BAO_FinancialAccount extends CRM_Financial_DAO_FinancialAcco
     $dependancy = array(
       array('Core', 'FinancialTrxn', 'to_financial_account_id'),
       array('Financial', 'FinancialTypeAccount', 'financial_account_id'),
-      );
+    );
     foreach ($dependancy as $name) {
-      require_once (str_replace('_', DIRECTORY_SEPARATOR, "CRM_" . $name[0] . "_BAO_" . $name[1]) . ".php");
+      require_once str_replace('_', DIRECTORY_SEPARATOR, "CRM_" . $name[0] . "_BAO_" . $name[1]) . ".php";
       $className = "CRM_{$name[0]}_BAO_{$name[1]}";
       $bao = new $className();
       $bao->$name[2] = $financialAccountId;
@@ -152,11 +158,10 @@ class CRM_Financial_BAO_FinancialAccount extends CRM_Financial_DAO_FinancialAcco
   /**
    * Get accounting code for a financial type with account relation Income Account is
    *
-   * @financialTypeId int      Financial Type Id
-   *
    * @param int $financialTypeId
    *
-   * @return accounting code
+   * @return int
+   *   accounting code
    * @static
    */
   public static function getAccountingCode($financialTypeId) {
@@ -177,13 +182,17 @@ WHERE cft.id = %1
   /**
    * Get AR account
    *
-   * @param $financialAccountId financial account id
+   * @param $financialAccountId
+   *   Financial account id.
    *
-   * @param $financialAccountTypeId financial account type id
+   * @param $financialAccountTypeId
+   *   Financial account type id.
    *
-   * @param \account|string $accountTypeCode account type code
+   * @param string $accountTypeCode
+   *   account type code
    *
-   * @return integer count
+   * @return integer
+   *   count
    * @static
    */
   public static function getARAccounts($financialAccountId, $financialAccountTypeId = NULL, $accountTypeCode = 'ar') {
@@ -198,6 +207,6 @@ WHERE cft.id = %1
       2 => array(strtolower($accountTypeCode), 'String'),
       3 => array($financialAccountId, 'Integer'),
     );
-     return CRM_Core_DAO::singleValueQuery($query, $params);
+    return CRM_Core_DAO::singleValueQuery($query, $params);
   }
 }