diff options
author | Frédéric Buclin <LpSolit@gmail.com> | 2010-02-01 12:46:42 -0800 |
---|---|---|
committer | Max Kanat-Alexander <mkanat@bugzilla.org> | 2010-02-01 12:46:42 -0800 |
commit | 26426fe87683c76702a2340bf852e8bb0eca7626 (patch) | |
tree | 4f683c215ee1e65dd1c24ba4fb460031030e5ba4 | |
parent | ad31a5706aed1cee3fa5c54733b1244a86042c7f (diff) | |
download | bugs-26426fe87683c76702a2340bf852e8bb0eca7626.tar bugs-26426fe87683c76702a2340bf852e8bb0eca7626.tar.gz bugs-26426fe87683c76702a2340bf852e8bb0eca7626.tar.bz2 bugs-26426fe87683c76702a2340bf852e8bb0eca7626.tar.xz bugs-26426fe87683c76702a2340bf852e8bb0eca7626.zip |
Bug 537746: Search criteria headers on buglist duplicate unnecessarily when bugidtype is in use
Patch by Frédéric Buclin <LpSolit@gmail.com> r/a=mkanat
-rw-r--r-- | Bugzilla/CGI.pm | 15 | ||||
-rw-r--r-- | Bugzilla/Search.pm | 9 | ||||
-rw-r--r-- | Bugzilla/Search/Quicksearch.pm | 2 | ||||
-rwxr-xr-x | query.cgi | 2 | ||||
-rw-r--r-- | template/en/default/search/form.html.tmpl | 6 |
5 files changed, 18 insertions, 16 deletions
diff --git a/Bugzilla/CGI.pm b/Bugzilla/CGI.pm index 8a0e2efe9..6e9dfd0ce 100644 --- a/Bugzilla/CGI.pm +++ b/Bugzilla/CGI.pm @@ -110,6 +110,7 @@ sub new { sub canonicalise_query { my ($self, @exclude) = @_; + $self->convert_old_params(); # Reconstruct the URL by concatenating the sorted param=value pairs my @parameters; foreach my $key (sort($self->param())) { @@ -134,6 +135,17 @@ sub canonicalise_query { return join("&", @parameters); } +sub convert_old_params { + my $self = shift; + + # bugidtype is now bug_id_type. + if ($self->param('bugidtype')) { + my $value = $self->param('bugidtype') eq 'exclude' ? 'nowords' : 'anyexact'; + $self->param('bug_id_type', $value); + $self->delete('bugidtype'); + } +} + sub clean_search_url { my $self = shift; # Delete any empty URL parameter. @@ -153,9 +165,6 @@ sub clean_search_url { } } - # Delete certain parameters if the associated parameter is empty. - $self->delete('bugidtype') if !$self->param('bug_id'); - # Delete leftovers from the login form $self->delete('Bugzilla_remember', 'GoAheadAndLogIn'); diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm index e6b9e8937..43b95f293 100644 --- a/Bugzilla/Search.pm +++ b/Bugzilla/Search.pm @@ -194,6 +194,7 @@ sub init { my $self = shift; my @fields = @{ $self->{'fields'} || [] }; my $params = $self->{'params'}; + $params->convert_old_params(); $self->{'user'} ||= Bugzilla->user; my $user = $self->{'user'}; @@ -290,14 +291,6 @@ sub init { } } - if ($params->param('bug_id')) { - my $type = "anyexact"; - if ($params->param('bugidtype') && $params->param('bugidtype') eq 'exclude') { - $type = "nowords"; - } - push(@specialchart, ["bug_id", $type, join(',', $params->param('bug_id'))]); - } - # If the user has selected all of either status or resolution, change to # selecting none. This is functionally equivalent, but quite a lot faster. # Also, if the status is __open__ or __closed__, translate those diff --git a/Bugzilla/Search/Quicksearch.pm b/Bugzilla/Search/Quicksearch.pm index bef463a3c..e3dcc7e89 100644 --- a/Bugzilla/Search/Quicksearch.pm +++ b/Bugzilla/Search/Quicksearch.pm @@ -232,7 +232,7 @@ sub _bug_numbers_only { # List of bug numbers. $cgi->param('bug_id', $searchstring); $cgi->param('order', 'bugs.bug_id'); - $cgi->param('bugidtype', 'include'); + $cgi->param('bug_id_type', 'include'); } } @@ -131,7 +131,7 @@ sub PrefillForm { "longdesc", "longdesc_type", "bug_file_loc", "bug_file_loc_type", "status_whiteboard", "status_whiteboard_type", "bug_id", - "bugidtype", "keywords", "keywords_type", + "bug_id_type", "keywords", "keywords_type", "deadlinefrom", "deadlineto", "x_axis_field", "y_axis_field", "z_axis_field", "chart_format", "cumulate", "x_labels_vertical", diff --git a/template/en/default/search/form.html.tmpl b/template/en/default/search/form.html.tmpl index 7db07fc79..ec0d2a90b 100644 --- a/template/en/default/search/form.html.tmpl +++ b/template/en/default/search/form.html.tmpl @@ -535,9 +535,9 @@ function doOnSelectProduct(selectmode) { <table> <tr> <td> - <select name="bugidtype"> - <option value="include"[% " selected" IF default.bugidtype.0 == "include" %]>Only include</option> - <option value="exclude"[% " selected" IF default.bugidtype.0 == "exclude" %]>Exclude</option> + <select name="bug_id_type"> + <option value="anyexact"[% " selected" IF default.bug_id_type.0 == "anyexact" %]>Only include</option> + <option value="nowords"[% " selected" IF default.bug_id_type.0 == "nowords" %]>Exclude</option> </select> <label for="bug_id">[% terms.bugs %] numbered</label>: </td> |