From: eileen Date: Fri, 22 Jan 2016 02:04:22 +0000 (+1300) Subject: CRM-17837 move summary columns to the right hand side when using rollup. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=0698350050f3f2dd0b53ac9f537cc2de678a5ce4;p=civicrm-core.git 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 --- 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. *