From 69719a15f1662cdbf6566fd4e823b09385fa81bc Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Fri, 27 Mar 2015 00:43:57 +1300 Subject: [PATCH] CRM-16184 CiviReport template, break connection between filters & fields for accordian display Sometimes fields are not present and filters are and this can break the layout --- CRM/Report/Form.php | 14 +++++++++++++- templates/CRM/Report/Form/Tabs/Filters.tpl | 6 +++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/CRM/Report/Form.php b/CRM/Report/Form.php index f8c85cec35..e677a9cb96 100644 --- a/CRM/Report/Form.php +++ b/CRM/Report/Form.php @@ -1041,9 +1041,20 @@ class CRM_Report_Form extends CRM_Core_Form { * Add filters to report. */ public function addFilters() { - $filters = array(); + $filters = $filterGroups =array(); $count = 1; + foreach ($this->_filters as $table => $attributes) { + if (isset($this->_columns[$table]['group_title'])) { + // The presence of 'group_title' is secret code for 'is_a_custom_table' + // which magically means to 'display in an accordian' + // here we make this explicit. + $filterGroups[$table] = array( + 'group_title' => $this->_columns[$table]['group_title'], + 'use_accordian_for_field_selection' => TRUE, + + ); + } foreach ($attributes as $fieldName => $field) { // get ready with option value pair // @ todo being able to specific options for a field (e.g a date field) in the field spec as an array rather than an override @@ -1159,6 +1170,7 @@ class CRM_Report_Form extends CRM_Core_Form { ); } $this->assign('filters', $filters); + $this->assign('filterGroups', $filterGroups); } /** diff --git a/templates/CRM/Report/Form/Tabs/Filters.tpl b/templates/CRM/Report/Form/Tabs/Filters.tpl index eeb0d9d815..e1db9d5064 100644 --- a/templates/CRM/Report/Form/Tabs/Filters.tpl +++ b/templates/CRM/Report/Form/Tabs/Filters.tpl @@ -30,7 +30,7 @@ {foreach from=$filters item=table key=tableName} {assign var="filterCount" value=$table|@count} {* Wrap custom field sets in collapsed accordion pane. *} - {if $colGroups.$tableName.group_title and $filterCount gte 1} + {if $filterGroups.$tableName.group_title and $filterCount gte 1} {* we should close table that contains other filter elements before we start building custom group accordian *} {if $counter eq 1} @@ -39,7 +39,7 @@ {/if} -- 2.25.1