]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 342113: Allow custom fields to appear as a discrete field in the search form
authorAlbert Ting <altlist@gmail.com>
Thu, 19 Mar 2015 08:35:17 +0000 (16:35 +0800)
committerByron Jones <glob@mozilla.com>
Thu, 19 Mar 2015 08:35:17 +0000 (16:35 +0800)
r=glob,a=glob

query.cgi
template/en/default/search/form.html.tmpl

index fab90eb2d8e39b4031aa2a3c3a8711eb52292ad4..c1d3390dfa797eb3fb72c2a5def1568ec68e5ad7 100755 (executable)
--- 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 }) };
 
index 0420811eeb3312344ba5ec110c1dc1436bafbe93..c9265f076ef10568a51f3457edddc18fb9dd3bdc 100644 (file)
@@ -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') %]
   </div>
 </div>