From 2e521b8c19cb7f152aecb2709c139e0d434362dc Mon Sep 17 00:00:00 2001 From: Edsel Date: Fri, 17 Mar 2017 12:21:33 +0530 Subject: [PATCH] CRM-20022 Extended function to support multiple batch labels ---------------------------------------- * CRM-20022: Add Batch Title to Columns, Grouping tabs on Contribution Summary report https://issues.civicrm.org/jira/browse/CRM-20022 --- CRM/Report/Form.php | 7 ++++++- CRM/Report/Form/Contribute/Summary.php | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CRM/Report/Form.php b/CRM/Report/Form.php index a8d4a1f7cd..b189831f59 100644 --- a/CRM/Report/Form.php +++ b/CRM/Report/Form.php @@ -4882,7 +4882,12 @@ LEFT JOIN civicrm_contact {$field['alias']} ON {$field['alias']}.id = {$this->_a $types = explode(',', $options); $labels = array(); foreach ($types as $value) { - $labels[$value] = CRM_Core_PseudoConstant::getLabel($baoName, $fieldName, $value); + if ($labelValue = CRM_Core_PseudoConstant::getLabel($baoName, $fieldName, $value)) { + $labels[$value] = $labelValue; + } + else { + $labels[$value] = CRM_Core_DAO::getFieldValue($baoName, $value, $fieldName); + } } return implode(', ', array_filter($labels)); } diff --git a/CRM/Report/Form/Contribute/Summary.php b/CRM/Report/Form/Contribute/Summary.php index 33cdec1e55..edb336ae05 100644 --- a/CRM/Report/Form/Contribute/Summary.php +++ b/CRM/Report/Form/Contribute/Summary.php @@ -251,6 +251,7 @@ class CRM_Report_Form_Contribute_Summary extends CRM_Report_Form { 'batch_id' => array( 'name' => 'batch_id', 'title' => ts('Batch Title'), + 'dbAlias' => 'GROUP_CONCAT(batch_civireport.batch_id SEPARATOR ",")', ), ), 'filters' => array( @@ -981,7 +982,7 @@ ROUND(AVG({$this->_aliases['civicrm_contribution_soft']}.amount), 2) as civicrm_ // convert batch id to batch title if (!empty($row['civicrm_batch_batch_id'])) { - $rows[$rowNum]['civicrm_batch_batch_id'] = CRM_Core_DAO::getFieldValue('CRM_Batch_BAO_Batch', $row['civicrm_batch_batch_id'], 'title'); + $rows[$rowNum]['civicrm_batch_batch_id'] = $this->getLabels($row['civicrm_batch_batch_id'], 'CRM_Batch_BAO_Batch', 'title'); $entryFound = TRUE; } -- 2.25.1