/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.3 |
+ | CiviCRM version 4.4 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2013 |
+--------------------------------------------------------------------+
protected $_nameFieldHonor = FALSE;
protected $_summary = NULL;
+ protected $_allBatches = NULL;
protected $_customGroupExtends = array(
'Contribution', 'Membership');
array('title' => ts('Contact Type'),
'no_repeat' => TRUE,
),
+ 'contact_sub_type' =>
+ array(
+ 'title' => ts('Contact SubType'),
+ 'no_repeat' => TRUE,
+ ),
'do_not_email' =>
array('title' => ts('Do Not Email'),
'no_repeat' => TRUE,
$this->_tagFilter = TRUE;
// Don't show Batch display column and filter unless batches are being used
- $this->_closedBatches = CRM_Batch_BAO_Batch::getBatches();
- if (!empty($this->_closedBatches)) {
+ $this->_allBatches = CRM_Batch_BAO_Batch::getBatches();
+ if (!empty($this->_allBatches)) {
$this->_columns['civicrm_batch']['dao'] = 'CRM_Batch_DAO_Batch';
$this->_columns['civicrm_batch']['fields']['batch_id'] = array(
'name' => 'id',
'title' => ts('Batch Name'),
'type' => CRM_Utils_Type::T_INT,
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
- 'options' => $this->_closedBatches,
+ 'options' => $this->_allBatches,
);
$this->_columns['civicrm_entity_batch']['dao'] = 'CRM_Batch_DAO_EntityBatch';
$this->_columns['civicrm_entity_batch']['fields']['entity_batch_id'] = array(
{$this->_aliases['civicrm_phone']}.is_primary = 1)";
}
//for contribution batches
- if ($this->_closedBatches &&
+ if ($this->_allBatches &&
(CRM_Utils_Array::value('batch_id', $this->_params['fields']) || !empty($this->_params['bid_value']))) {
$this->_from .= "
+ LEFT JOIN civicrm_entity_financial_trxn tx ON (tx.entity_id = {$this->_aliases['civicrm_contribution']}.id AND
+ tx.entity_table = 'civicrm_contribution')
LEFT JOIN civicrm_entity_batch {$this->_aliases['civicrm_entity_batch']}
- ON ({$this->_aliases['civicrm_entity_batch']}.entity_id = {$this->_aliases['civicrm_contribution']}.id AND
- {$this->_aliases['civicrm_entity_batch']}.entity_table = 'civicrm_contribution')
+ ON ({$this->_aliases['civicrm_entity_batch']}.entity_id = tx.financial_trxn_id AND
+ {$this->_aliases['civicrm_entity_batch']}.entity_table = 'civicrm_financial_trxn')
LEFT JOIN civicrm_batch {$this->_aliases['civicrm_batch']}
ON {$this->_aliases['civicrm_batch']}.id = {$this->_aliases['civicrm_entity_batch']}.batch_id";
}
$sql = "{$select} {$this->_from} {$this->_where} {$group}";
$dao = CRM_Core_DAO::executeQuery($sql);
+ $totalAmount = $average = array();
while ($dao->fetch()) {
$totalAmount[] = CRM_Utils_Money::format($dao->amount, $dao->currency)."(".$dao->count.")";
$average[] = CRM_Utils_Money::format($dao->avg, $dao->currency);