From 96b82f459b112f5fbb55ee24129977b4c6a2e4ad Mon Sep 17 00:00:00 2001 From: Edsel Date: Wed, 15 Feb 2017 17:04:47 +0530 Subject: [PATCH] CRM-20285 Added credit card type field to recurring contributions report ---------------------------------------- * CRM-19997: Add Credit card type fields in contribution related reports https://issues.civicrm.org/jira/browse/CRM-19997 ---------------------------------------- * CRM-20285: https://issues.civicrm.org/jira/browse/CRM-20285 CRM-20285 Added credit card type field for recurring contributions report ---------------------------------------- * CRM-20285: Add credit card type field for Recurring Contributions report https://issues.civicrm.org/jira/browse/CRM-20285 CRM-20285 Fixed report to read from card type rather than credit card type ---------------------------------------- * CRM-20285: Add credit card type field for Recurring Contributions report https://issues.civicrm.org/jira/browse/CRM-20285 CRM-20285 Removed line break ---------------------------------------- * CRM-20285: https://issues.civicrm.org/jira/browse/CRM-20285 --- CRM/Report/Form/Contribute/Recur.php | 32 ++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/CRM/Report/Form/Contribute/Recur.php b/CRM/Report/Form/Contribute/Recur.php index 1b7e2780f1..ee55061569 100644 --- a/CRM/Report/Form/Contribute/Recur.php +++ b/CRM/Report/Form/Contribute/Recur.php @@ -106,6 +106,24 @@ class CRM_Report_Form_Contribute_Recur 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_contribution_recur' => array( 'dao' => 'CRM_Contribute_DAO_ContributionRecur', 'fields' => array( @@ -263,6 +281,16 @@ class CRM_Report_Form_Contribute_Recur extends CRM_Report_Form { LEFT JOIN civicrm_phone {$this->_aliases['civicrm_phone']} ON ({$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_phone']}.contact_id AND {$this->_aliases['civicrm_phone']}.is_primary = 1)"; + + // for credit card type + if ($this->isTableSelected('civicrm_financial_trxn')) { + $this->_from .= " + 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"; + } } public function groupBy() { @@ -370,6 +398,10 @@ class CRM_Report_Form_Contribute_Recur extends CRM_Report_Form { if ($value = CRM_Utils_Array::value('civicrm_contribution_recur_amount', $row)) { $rows[$rowNum]['civicrm_contribution_recur_amount'] = CRM_Utils_Money::format($rows[$rowNum]['civicrm_contribution_recur_amount'], $rows[$rowNum]['civicrm_contribution_recur_currency']); } + + 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'); + } } } -- 2.25.1