From: Albert Ting Date: Thu, 19 Mar 2015 08:35:17 +0000 (+0800) Subject: Bug 342113: Allow custom fields to appear as a discrete field in the search form X-Git-Tag: release-5.1.1~322 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=42584a88aecb7430d6cef2c7b73779842ea5c80d;p=thirdparty%2Fbugzilla.git Bug 342113: Allow custom fields to appear as a discrete field in the search form r=glob,a=glob --- diff --git a/query.cgi b/query.cgi index fab90eb2d8..c1d3390dfa 100755 --- a/query.cgi +++ b/query.cgi @@ -208,6 +208,15 @@ $vars->{'priority'} = Bugzilla::Field->new({name => 'priority'})->legal_values; $vars->{'bug_severity'} = Bugzilla::Field->new({name => 'bug_severity'})->legal_values; $vars->{'resolution'} = Bugzilla::Field->new({name => 'resolution'})->legal_values; +# grab custom fields +my @custom_fields = Bugzilla->active_custom_fields; +$vars->{'custom_fields'} = \@custom_fields; +foreach my $cf (@custom_fields) { + if ($cf->type == FIELD_TYPE_SINGLE_SELECT || $cf->type == FIELD_TYPE_MULTI_SELECT) { + $vars->{$cf->name} = $cf->legal_values; + } +} + # Boolean charts my @fields = @{ Bugzilla->fields({ obsolete => 0 }) }; diff --git a/template/en/default/search/form.html.tmpl b/template/en/default/search/form.html.tmpl index 0420811eeb..c9265f076e 100644 --- a/template/en/default/search/form.html.tmpl +++ b/template/en/default/search/form.html.tmpl @@ -127,6 +127,10 @@ TUI_hide_default('information_query'); { field => bug_fields.keywords, accesskey => 'k', qtypes => ['allwords', 'anywords', 'nowords', 'regexp', 'notregexp'] } ] %] + [% FOREACH field = custom_fields %] + [% freetext_fields.push({ field => field }) IF field.type == constants.FIELD_TYPE_FREETEXT or field.type == constants.FIELD_TYPE_TEXTAREA %] + [% END %] + [% Hook.process('before_freetext_fields') %] [%# loop through a bunch of free text fields and print out their text stuff %] @@ -215,6 +219,15 @@ TUI_hide_default('information_query'); accesskey =>"o" value => default.op_sys %] + [% FOREACH field = custom_fields %] + [% IF field.type == constants.FIELD_TYPE_SINGLE_SELECT or + field.type == constants.FIELD_TYPE_MULTI_SELECT %] + [% INCLUDE "search/field.html.tmpl" + field => field + value => default.${field.name} + %] + [% END %] + [% END %] [% Hook.process('after_selects_bottom') %]