From cce8615c1cb117682aac6c8e0fd143e6b6dadfdf Mon Sep 17 00:00:00 2001 From: Edsel Date: Wed, 15 Feb 2017 16:45:23 +0530 Subject: [PATCH] CRM-20281 Added credit card type field to soft credit report ---------------------------------------- * CRM-19997: Add Credit card type fields in contribution related reports https://issues.civicrm.org/jira/browse/CRM-19997 ---------------------------------------- * CRM-20281: https://issues.civicrm.org/jira/browse/CRM-20281 CRM-20281 Added credit card type field for Soft Credit report ---------------------------------------- * CRM-20281: Add credit card type field for Soft Credit Report https://issues.civicrm.org/jira/browse/CRM-20281 CRM-20281 Fixed report to read from card type rather than credit card type ---------------------------------------- * CRM-20281: Add credit card type field for Soft Credit Report https://issues.civicrm.org/jira/browse/CRM-20281 CRM-20281 Removed line break ---------------------------------------- * CRM-20281: https://issues.civicrm.org/jira/browse/CRM-20281 --- CRM/Report/Form/Contribute/SoftCredit.php | 25 +++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/CRM/Report/Form/Contribute/SoftCredit.php b/CRM/Report/Form/Contribute/SoftCredit.php index ae6b737336b2..1ebfb6e83071 100644 --- a/CRM/Report/Form/Contribute/SoftCredit.php +++ b/CRM/Report/Form/Contribute/SoftCredit.php @@ -302,6 +302,24 @@ public function __construct() { ), 'grouping' => 'softcredit-fields', ), + '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 @@ -468,6 +486,8 @@ public function from() { {$alias}.contact_id AND {$alias}.is_primary = 1\n"; } + // for credit card type + $this->addFinancialTrxnFromClause(); } public function groupBy() { @@ -641,6 +661,11 @@ public function alterDisplay(&$rows) { $entryFound = TRUE; } + if (!empty($row['civicrm_financial_trxn_card_type']) && !in_array('Subtotal', $rows[$rowNum])) { + $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) {