CRM-20273 Added credit card type field for contribution details report
authorEdsel <edsel.lopez@jmaconsulting.biz>
Wed, 15 Mar 2017 10:35:05 +0000 (16:05 +0530)
committerdeb.monish <monish.deb@jmaconsulting.biz>
Tue, 28 Mar 2017 09:33:05 +0000 (15:03 +0530)
----------------------------------------
* CRM-20273: Add credit card type field for Contribution Details Report
  https://issues.civicrm.org/jira/browse/CRM-20273

CRM/Report/Form/Contribute/Detail.php

index e09f92466bd333874b6732892ea1bdc423a9028d..ac3c5852ab44d024651bd3ff663d10433191baed 100644 (file)
@@ -292,7 +292,10 @@ class CRM_Report_Form_Contribute_Detail extends CRM_Report_Form {
       'civicrm_financial_trxn' => array(
         'dao' => 'CRM_Financial_DAO_FinancialTrxn',
         'fields' => array(
-          'credit_card_type' => array('title' => ts('Credit Card Type')),
+          'credit_card_type' => array(
+            'title' => ts('Credit Card Type'),
+            'dbAlias' => 'GROUP_CONCAT(financial_trxn_civireport.credit_card_type SEPARATOR ",")',
+          ),
         ),
         'filters' => array(
           'credit_card_type' => array(
@@ -691,7 +694,6 @@ UNION ALL
     $paymentInstruments = CRM_Contribute_PseudoConstant::paymentInstrument();
     $contributionPages = CRM_Contribute_PseudoConstant::contributionPage();
     $batches = CRM_Batch_BAO_Batch::getBatches();
-    $creditCardTypes = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_FinancialTrxn', 'credit_card_type');
     foreach ($rows as $rowNum => $row) {
       if (!empty($this->_noRepeats) && $this->_outputMode != 'csv') {
         // don't repeat contact details if its same as the previous row
@@ -767,7 +769,7 @@ UNION ALL
         $entryFound = TRUE;
       }
       if (!empty($row['civicrm_financial_trxn_credit_card_type'])) {
-        $rows[$rowNum]['civicrm_financial_trxn_credit_card_type'] = CRM_Utils_Array::value($row['civicrm_financial_trxn_credit_card_type'], $creditCardTypes);
+        $rows[$rowNum]['civicrm_financial_trxn_credit_card_type'] = $this->getGroupCreditCardType($row['civicrm_financial_trxn_credit_card_type']);
         $entryFound = TRUE;
       }