From dd52ea1b9baad23990c47a3186933e63b0cc01bb Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Sat, 3 Jan 2009 01:08:27 +0000 Subject: Bug 377956: Tabular and graphical reports should support single-select custom fields - Patch by Frédéric Buclin r=mkanat a=LpSolit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- query.cgi | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'query.cgi') diff --git a/query.cgi b/query.cgi index 5998c31ab..f41310bb7 100755 --- a/query.cgi +++ b/query.cgi @@ -116,7 +116,7 @@ sub PrefillForm { my $foundone = 0; # Nothing must be undef, otherwise the template complains. - foreach my $name ("bug_status", "resolution", "assigned_to", + my @list = ("bug_status", "resolution", "assigned_to", "rep_platform", "priority", "bug_severity", "classification", "product", "reporter", "op_sys", "component", "version", "chfield", "chfieldfrom", @@ -133,8 +133,13 @@ sub PrefillForm { "x_axis_field", "y_axis_field", "z_axis_field", "chart_format", "cumulate", "x_labels_vertical", "category", "subcategory", "name", "newcategory", - "newsubcategory", "public", "frequency") - { + "newsubcategory", "public", "frequency"); + # These fields can also have default values (when used in reports). + my @custom_select_fields = + grep { $_->type == FIELD_TYPE_SINGLE_SELECT } Bugzilla->active_custom_fields; + push(@list, map { $_->name } @custom_select_fields); + + foreach my $name (@list) { $default{$name} = []; } @@ -343,6 +348,13 @@ if (($cgi->param('query_format') || $cgi->param('format') || "") $vars->{'category'} = Bugzilla::Chart::getVisibleSeries(); } +if ($cgi->param('format') && $cgi->param('format') =~ /^report-(table|graph)$/) { + # Get legal custom fields for tabular and graphical reports. + my @custom_fields_for_reports = + grep { $_->type == FIELD_TYPE_SINGLE_SELECT } Bugzilla->active_custom_fields; + $vars->{'custom_fields'} = \@custom_fields_for_reports; +} + $vars->{'known_name'} = $cgi->param('known_name'); -- cgit v1.2.3-24-g4f1b