Skip to content

Commit

Permalink
Merge pull request #9995 from JMAConsulting/CRM-20282
Browse files Browse the repository at this point in the history
CRM-20282 Added credit card type field to bookkeeping report
  • Loading branch information
eileenmcnaughton authored Mar 17, 2017
2 parents 19465c9 + 106bf8f commit ce2ed39
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions CRM/Report/Form/Contribute/Bookkeeping.php
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,9 @@ public function __construct() {
'title' => ts('Trans #'),
'default' => TRUE,
),
'card_type' => array(
'title' => ts('Credit Card Type'),
),
),
'filters' => array(
'payment_instrument_id' => array(
Expand All @@ -341,6 +344,13 @@ public function __construct() {
'options' => CRM_Contribute_PseudoConstant::contributionStatus(),
'default' => array(1),
),
'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,
),
),
'order_bys' => array(
'payment_instrument_id' => array('title' => ts('Payment Method')),
Expand Down Expand Up @@ -602,6 +612,7 @@ public function alterDisplay(&$rows) {
$contributionTypes = CRM_Contribute_PseudoConstant::financialType();
$paymentInstruments = CRM_Contribute_PseudoConstant::paymentInstrument();
$contributionStatus = CRM_Contribute_PseudoConstant::contributionStatus();
$creditCardTypes = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_FinancialTrxn', 'card_type');
foreach ($rows as $rowNum => $row) {
// convert display name to links
if (array_key_exists('civicrm_contact_sort_name', $row) &&
Expand Down Expand Up @@ -643,6 +654,11 @@ public function alterDisplay(&$rows) {
$entryFound = TRUE;
}

if (!empty($row['civicrm_financial_trxn_card_type'])) {
$rows[$rowNum]['civicrm_financial_trxn_card_type'] = CRM_Utils_Array::value($row['civicrm_financial_trxn_card_type'], $creditCardTypes);
$entryFound = TRUE;
}

// display birthday in the configured custom format
if (array_key_exists('civicrm_contact_birth_date', $row)) {
$birthDate = $row['civicrm_contact_birth_date'];
Expand Down

0 comments on commit ce2ed39

Please sign in to comment.