CRM-20279 Added credit card type field to SYBUNT report
authorEdsel <edsel.lopez@jmaconsulting.biz>
Wed, 15 Feb 2017 10:49:06 +0000 (16:19 +0530)
committerdeb.monish <monish.deb@jmaconsulting.biz>
Fri, 24 Mar 2017 06:23:13 +0000 (11:53 +0530)
----------------------------------------
* CRM-19997: Add Credit card type fields in contribution related reports
  https://issues.civicrm.org/jira/browse/CRM-19997

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

CRM-20279 Added credit card type field for SYBUNT report

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

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

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

CRM-20279 Removed line break

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

CRM/Report/Form/Contribute/Sybunt.php

index a42bb1623b1aa022700336c7da2195de8f7a1019..0892bb172d7cc266d60ece6a2ce7fa1bf56093ae 100644 (file)
@@ -246,6 +246,26 @@ class CRM_Report_Form_Contribute_Sybunt 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,
+            'default' => NULL,
+            'options' => CRM_Financial_DAO_FinancialTrxn::buildOptions('card_type'),
+            'type' => CRM_Utils_Type::T_STRING,
+          ),
+        ),
+      ),
+    );
 
     // If we have a campaign, build out the relevant elements
     if ($campaignEnabled && !empty($this->activeCampaigns)) {
@@ -344,6 +364,9 @@ class CRM_Report_Form_Contribute_Sybunt extends CRM_Report_Form {
                       ON {$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_phone']}.contact_id AND
                          {$this->_aliases['civicrm_phone']}.is_primary = 1";
     }
+    // for credit card type
+    $this->addFinancialTrxnFromClause();
+
     $this->addAddressFromClause();
   }
 
@@ -612,6 +635,11 @@ class CRM_Report_Form_Contribute_Sybunt 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) {