bulk comment fixes
[civicrm-core.git] / CRM / Contribute / PseudoConstant.php
index e83383a3ebd4c49f223b62acb1cd8987a2c92d94..5811c002770e065ae40dd931f4eacca3ec4ec443 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$
  *
  */
@@ -105,6 +105,13 @@ class CRM_Contribute_PseudoConstant extends CRM_Core_PseudoConstant {
    */
   private static $pcpStatus;
 
+  /**
+   * contribution / financial batches
+   * @var array
+   * @static
+   */
+  private static $batch;
+
   /**
    * DEPRECATED. Please use the buildOptions() method in the appropriate BAO object.
    *
@@ -141,6 +148,12 @@ class CRM_Contribute_PseudoConstant extends CRM_Core_PseudoConstant {
    * Get all the financial Accounts
    *
    * @access public
+   *
+   * @param null $id
+   * @param null $financialAccountTypeId
+   * @param string $retrieveColumn
+   * @param string $key
+   *
    * @return array - array reference of all financial accounts if any
    * @static
    */
@@ -406,5 +419,34 @@ class CRM_Contribute_PseudoConstant extends CRM_Core_PseudoConstant {
 
     return self::$financialTypeAccount[$financialTypeId];
   }
+
+  /**
+   * Get all batches
+   *
+   * @access public
+   *
+   * @return array - array reference of all batches if any
+   * @static
+   */
+  public static function &batch($id = NULL) {
+    if (!self::$batch) {
+      $orderBy = " id DESC ";
+      CRM_Core_PseudoConstant::populate(
+        self::$batch,
+        'CRM_Batch_DAO_Batch',
+        TRUE,
+        'title',
+        NULL,
+        NULL,
+        $orderBy
+      );
+    }
+
+    if ($id) {
+      $result = CRM_Utils_Array::value($id, self::$batch);
+      return $result;
+    }
+    return self::$batch;
+  }
 }