From 0698350050f3f2dd0b53ac9f537cc2de678a5ce4 Mon Sep 17 00:00:00 2001 From: eileen Date: Fri, 22 Jan 2016 15:04:22 +1300 Subject: [PATCH] CRM-17837 move summary columns to the right hand side when using rollup. Basically it just looks 'odd' to have calculated summary columns and then have custom fields to the right of them in a report Change-Id: If46675141028bf362c3b3c2b509d9cd30fb25651 --- CRM/Report/Form.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/CRM/Report/Form.php b/CRM/Report/Form.php index 0864946101..cee6653953 100644 --- a/CRM/Report/Form.php +++ b/CRM/Report/Form.php @@ -2159,6 +2159,9 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND } } } + if ($this->_grandFlag) { + $this->moveSummaryColumnsToTheRightHandSide(); + } $this->assign('grandStat', $this->rollupRow); return TRUE; @@ -2852,6 +2855,17 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND // use this method to modify $this->_columnHeaders } + /** + * Move totals columns to the right edge of the table. + * + * It seems like a more logical layout to have any totals columns on the far right regardless of + * the location of the rest of their table. + */ + public function moveSummaryColumnsToTheRightHandSide() { + $statHeaders = (array_intersect_key($this->_columnHeaders, array_flip($this->_statFields))); + $this->_columnHeaders = array_merge(array_diff_key($this->_columnHeaders, $statHeaders), $this->_columnHeaders, $statHeaders); + } + /** * Assign rows to the template. * -- 2.25.1