X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FReport%2FForm%2FContribute%2FSummary.php;h=33cdec1e551558cf1480d2d8ccc85a4891fa5bcf;hb=ea00b88720837cfefa946cb90d1bed58efd18f79;hp=684032ad1f72cd62c50be9ef47f840434e35b067;hpb=8550efbefa508769e930a29ba23d912927b2a1bc;p=civicrm-core.git diff --git a/CRM/Report/Form/Contribute/Summary.php b/CRM/Report/Form/Contribute/Summary.php index 684032ad1f..33cdec1e55 100644 --- a/CRM/Report/Form/Contribute/Summary.php +++ b/CRM/Report/Form/Contribute/Summary.php @@ -226,9 +226,33 @@ class CRM_Report_Form_Contribute_Summary extends CRM_Report_Form { ), ), ), + 'civicrm_financial_trxn' => array( + 'dao' => 'CRM_Financial_DAO_FinancialTrxn', + 'fields' => array( + 'card_type' => array( + 'title' => ts('Credit Card Type'), + 'dbAlias' => 'GROUP_CONCAT(financial_trxn_civireport.card_type SEPARATOR ",")', + ), + ), + 'filters' => array( + 'card_type' => array( + 'title' => ts('Credit Card Type'), + 'operatorType' => CRM_Report_Form::OP_MULTISELECT, + 'options' => CRM_Core_PseudoConstant::get('CRM_Financial_DAO_FinancialTrxn', 'card_type'), + 'default' => NULL, + 'type' => CRM_Utils_Type::T_STRING, + ), + ), + ), 'civicrm_batch' => array( 'dao' => 'CRM_Batch_DAO_EntityBatch', 'grouping' => 'contri-fields', + 'fields' => array( + 'batch_id' => array( + 'name' => 'batch_id', + 'title' => ts('Batch Title'), + ), + ), 'filters' => array( 'batch_id' => array( 'title' => ts('Batch Title'), @@ -237,6 +261,9 @@ class CRM_Report_Form_Contribute_Summary extends CRM_Report_Form { 'type' => CRM_Utils_Type::T_INT, ), ), + 'group_bys' => array( + 'batch_id' => array('title' => ts('Batch ID')), + ), ), 'civicrm_contribution_soft' => array( 'dao' => 'CRM_Contribute_DAO_ContributionSoft', @@ -495,14 +522,25 @@ class CRM_Report_Form_Contribute_Summary extends CRM_Report_Form { {$this->_aliases['civicrm_phone']}.is_primary = 1)"; $this->addAddressFromClause(); - if (!empty($this->_params['batch_id_value'])) { + //for contribution batches + if ($this->isTableSelected('civicrm_batch')) { + $this->_from .= " + LEFT JOIN civicrm_entity_financial_trxn eft + ON eft.entity_id = {$this->_aliases['civicrm_contribution']}.id AND + eft.entity_table = 'civicrm_contribution' + LEFT JOIN civicrm_entity_batch {$this->_aliases['civicrm_batch']} + ON ({$this->_aliases['civicrm_batch']}.entity_id = eft.financial_trxn_id + AND {$this->_aliases['civicrm_batch']}.entity_table = 'civicrm_financial_trxn')"; + } + + // for credit card type + if ($this->isTableSelected('civicrm_financial_trxn')) { $this->_from .= " - LEFT JOIN civicrm_entity_financial_trxn eft - ON eft.entity_id = {$this->_aliases['civicrm_contribution']}.id AND - eft.entity_table = 'civicrm_contribution' - LEFT JOIN civicrm_entity_batch {$this->_aliases['civicrm_batch']} - ON {$this->_aliases['civicrm_batch']}.entity_id = eft.financial_trxn_id AND - {$this->_aliases['civicrm_batch']}.entity_table = 'civicrm_financial_trxn'\n"; + LEFT JOIN civicrm_entity_financial_trxn eftcc + ON ({$this->_aliases['civicrm_contribution']}.id = eftcc.entity_id AND + eftcc.entity_table = 'civicrm_contribution') + LEFT JOIN civicrm_financial_trxn {$this->_aliases['civicrm_financial_trxn']} + ON {$this->_aliases['civicrm_financial_trxn']}.id = eftcc.financial_trxn_id"; } } @@ -928,6 +966,11 @@ ROUND(AVG({$this->_aliases['civicrm_contribution_soft']}.amount), 2) as civicrm_ $entryFound = TRUE; } + if (!empty($row['civicrm_financial_trxn_card_type'])) { + $rows[$rowNum]['civicrm_financial_trxn_card_type'] = $this->getLabels($row['civicrm_financial_trxn_card_type'], 'CRM_Financial_DAO_FinancialTrxn', 'card_type'); + $entryFound = TRUE; + } + // If using campaigns, convert campaign_id to campaign title if (array_key_exists('civicrm_contribution_campaign_id', $row)) { if ($value = $row['civicrm_contribution_campaign_id']) { @@ -936,6 +979,12 @@ ROUND(AVG({$this->_aliases['civicrm_contribution_soft']}.amount), 2) as civicrm_ $entryFound = TRUE; } + // convert batch id to batch title + if (!empty($row['civicrm_batch_batch_id'])) { + $rows[$rowNum]['civicrm_batch_batch_id'] = CRM_Core_DAO::getFieldValue('CRM_Batch_BAO_Batch', $row['civicrm_batch_batch_id'], 'title'); + $entryFound = TRUE; + } + $entryFound = $this->alterDisplayAddressFields($row, $rows, $rowNum, 'contribute/detail', 'List all contribution(s) for this ') ? TRUE : $entryFound; $entryFound = $this->alterDisplayContactFields($row, $rows, $rowNum, 'contribute/detail', 'List all contribution(s) for this ') ? TRUE : $entryFound;