From: Edsel Date: Wed, 15 Feb 2017 11:29:55 +0000 (+0530) Subject: CRM-20284 Added credit card type field to contribute aggregate by relationship report X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=37e697e71d8bdcf5ef5f7ec98c3cf8f8c7c6f0cc;p=civicrm-core.git CRM-20284 Added credit card type field to contribute aggregate by relationship report ---------------------------------------- * CRM-19997: Add Credit card type fields in contribution related reports https://issues.civicrm.org/jira/browse/CRM-19997 ---------------------------------------- * CRM-20284: https://issues.civicrm.org/jira/browse/CRM-20284 CRM-20284 Added credit card type field for Contribution Aggregate by relationship report ---------------------------------------- * CRM-20284: Add credit card type field for Contribution Aggregate by Relationship report https://issues.civicrm.org/jira/browse/CRM-20284 CRM-20284 Fixed report to read from card type rather than credit card type ---------------------------------------- * CRM-20284: Add credit card type field for Contribution Aggregate by Relationship report https://issues.civicrm.org/jira/browse/CRM-20284 CRM-20284 Removed line break ---------------------------------------- * CRM-20284: https://issues.civicrm.org/jira/browse/CRM-20284 --- diff --git a/CRM/Report/Form/Contribute/History.php b/CRM/Report/Form/Contribute/History.php index aaf3039058..d70e4847a0 100644 --- a/CRM/Report/Form/Contribute/History.php +++ b/CRM/Report/Form/Contribute/History.php @@ -269,6 +269,26 @@ class CRM_Report_Form_Contribute_History 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, + ), + ), + ), + ); $this->_columns['civicrm_contribution']['fields']['civicrm_upto_' . $this->_yearStatisticsFrom] = array( @@ -394,13 +414,10 @@ class CRM_Report_Form_Contribute_History extends CRM_Report_Form { $this->_relationshipFrom = " INNER JOIN civicrm_relationship {$this->_aliases['civicrm_relationship']} ON (({$this->_aliases['civicrm_relationship']}.contact_id_a = {$relContacAlias}.id OR {$this->_aliases['civicrm_relationship']}.contact_id_b = {$relContacAlias}.id ) AND {$this->_aliases['civicrm_relationship']}.is_active = 1) "; - if ($this->_addressField) { - $this->_from .= " - LEFT JOIN civicrm_address {$this->_aliases['civicrm_address']} - ON {$this->_aliases['civicrm_contact']}.id = - {$this->_aliases['civicrm_address']}.contact_id AND - {$this->_aliases['civicrm_address']}.is_primary = 1\n"; - } + $this->addAddressFromClause(); + + // for credit card type + $this->addFinancialTrxnFromClause(); } public function where() { @@ -859,6 +876,11 @@ class CRM_Report_Form_Contribute_History extends CRM_Report_Form { $rows[$rowNum]['civicrm_contact_sort_name_hover'] = ts("View Contribution Details for this Contact."); } + 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; + } + // display birthday in the configured custom format if (array_key_exists('civicrm_contact_birth_date', $row)) { $birthDate = $row['civicrm_contact_birth_date'];