CRM-20280 Added credit card type field to LYBUNT report
authorEdsel <edsel.lopez@jmaconsulting.biz>
Wed, 15 Feb 2017 10:55:39 +0000 (16:25 +0530)
committerdeb.monish <monish.deb@jmaconsulting.biz>
Fri, 24 Mar 2017 06:15:21 +0000 (11:45 +0530)
----------------------------------------
* CRM-19997: Add Credit card type fields in contribution related reports
  https://issues.civicrm.org/jira/browse/CRM-19997

----------------------------------------
* CRM-20280:
  https://issues.civicrm.org/jira/browse/CRM-20280

CRM-20280 Added credit card type field for LYBUNT report

----------------------------------------
* CRM-20280: Add credit card type field for LYBUNT report
  https://issues.civicrm.org/jira/browse/CRM-20280

CRM-20280 Fixed report to read from card type rather than credit card type

----------------------------------------
* CRM-20280: Add credit card type field for LYBUNT report
  https://issues.civicrm.org/jira/browse/CRM-20280

CRM-20280 Removed line break

----------------------------------------
* CRM-20280:
  https://issues.civicrm.org/jira/browse/CRM-20280

CRM/Report/Form/Contribute/Lybunt.php

index 608e408f360cac5352ddb41e29d973cffc222039..93bcf8ec56a367408d166fb5328309ebe8be9ea4 100644 (file)
@@ -248,6 +248,26 @@ class CRM_Report_Form_Contribute_Lybunt extends CRM_Report_Form {
         ),
       ),
     );
+    $this->_columns += array(
+      '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_Financial_DAO_FinancialTrxn::buildOptions('card_type'),
+            'default' => NULL,
+            'type' => CRM_Utils_Type::T_STRING,
+          ),
+        ),
+      ),
+    );
 
     // If we have a campaign, build out the relevant elements
     if ($campaignEnabled && !empty($this->activeCampaigns)) {
@@ -358,6 +378,8 @@ class CRM_Report_Form_Contribute_Lybunt extends CRM_Report_Form {
       $this->selectivelyAddLocationTablesJoinsToFilterQuery();
     }
 
+    // for credit card type
+    $this->addFinancialTrxnFromClause();
   }
 
   /**
@@ -734,6 +756,11 @@ class CRM_Report_Form_Contribute_Lybunt extends CRM_Report_Form {
         $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;
+      }
+
       // skip looking further in rows, if first row itself doesn't
       // have the column we need
       if (!$entryFound) {