From 200471816d8bebfc6b5d40b19c72d8fad401d87b Mon Sep 17 00:00:00 2001 From: jitendrapurohit Date: Wed, 13 Jul 2016 12:23:03 +0530 Subject: [PATCH] fix membership summary report group by clause --- CRM/Report/Form/Member/Summary.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/CRM/Report/Form/Member/Summary.php b/CRM/Report/Form/Member/Summary.php index c238084cb5..f7d2f77890 100644 --- a/CRM/Report/Form/Member/Summary.php +++ b/CRM/Report/Form/Member/Summary.php @@ -363,13 +363,14 @@ class CRM_Report_Form_Member_Summary extends CRM_Report_Form { !empty($this->_params['group_bys_freq'][$fieldName]) ) { - $append = "YEAR({$field['dbAlias']}),"; + $append = "YEAR({$field['dbAlias']})"; if (in_array(strtolower($this->_params['group_bys_freq'][$fieldName]), array('year') )) { $append = ''; } - $this->_groupBy[] = "$append {$this->_params['group_bys_freq'][$fieldName]}({$field['dbAlias']})"; + $this->_groupBy[] = $append; + $this->_groupBy[] = "{$this->_params['group_bys_freq'][$fieldName]}({$field['dbAlias']})"; $append = TRUE; } else { @@ -381,8 +382,8 @@ class CRM_Report_Form_Member_Summary extends CRM_Report_Form { } $this->_rollup = ' WITH ROLLUP'; - $this->appendSelect($this->_selectClauses, $this->_groupBy); - $this->_groupBy = 'GROUP BY ' . implode(', ', $this->_groupBy) . + $this->appendSelect($this->_selectClauses, array_filter($this->_groupBy)); + $this->_groupBy = 'GROUP BY ' . implode(', ', array_filter($this->_groupBy)) . " {$this->_rollup} "; } else { -- 2.25.1