return;
case 'contribution_batch_id':
- $batches = CRM_Batch_BAO_Batch::getBatches();
+ $batches = CRM_Contribute_PseudoConstant::batch();
$query->_where[$grouping][] = " civicrm_entity_batch.batch_id $op $value";
$query->_qill[$grouping][] = ts('Batch Name %1 %2', array(1 => $op, 2 => $batches[$value]));
$query->_tables['civicrm_contribution'] = $query->_whereTables['civicrm_contribution'] = 1;
CRM_Campaign_BAO_Campaign::addCampaignInComponentSearch($form, 'contribution_campaign_id');
// Add batch select
- $batches = CRM_Batch_BAO_Batch::getBatches();
+ $batches = CRM_Contribute_PseudoConstant::batch();
if ( !empty( $batches ) ) {
$form->add('select', 'contribution_batch_id',
*/
private static $pcpStatus;
+ /**
+ * contribution / financial batches
+ * @var array
+ * @static
+ */
+ private static $batch;
+
/**
* Get all the financial types
*
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;
+ }
}