diff options
author | mkanat%bugzilla.org <> | 2009-11-09 20:09:03 +0100 |
---|---|---|
committer | mkanat%bugzilla.org <> | 2009-11-09 20:09:03 +0100 |
commit | 6ead1a2575509273484fd9c3a9186ebec2f338b8 (patch) | |
tree | 157eeb3a8e5797835478e0e8f39b7767c40bd6e0 /Bugzilla/Search.pm | |
parent | 6188fad092e9f347a111ed30d0e21bb048d69998 (diff) | |
download | bugzilla-6ead1a2575509273484fd9c3a9186ebec2f338b8.tar.gz bugzilla-6ead1a2575509273484fd9c3a9186ebec2f338b8.tar.xz |
Bug 524669: Allow every simple field in fielddefs to be specified directly in search URLs.
Patch by Max Kanat-Alexander <mkanat@bugzilla.org> r=gerv, a=mkanat
Diffstat (limited to 'Bugzilla/Search.pm')
-rw-r--r-- | Bugzilla/Search.pm | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm index 9ba7a8c42..fa18a0e78 100644 --- a/Bugzilla/Search.pm +++ b/Bugzilla/Search.pm @@ -328,27 +328,30 @@ sub init { } } - my @legal_fields = ("product", "version", "assigned_to", "reporter", - "component", "classification", "target_milestone", - "bug_group"); - - # Include custom select fields. - push(@legal_fields, map { $_->name } @select_fields); - push(@legal_fields, map { $_->name } @multi_select_fields); - - foreach my $field ($params->param()) { - if (lsearch(\@legal_fields, $field) != -1) { - push(@specialchart, [$field, "anyexact", - join(',', $params->param($field))]); + # All fields that don't have a . in their name should be specifyable + # in the URL directly. + my @legal_fields = grep { $_->name !~ /\./ } Bugzilla->get_fields; + if (!$user->is_timetracker) { + foreach my $field (TIMETRACKING_FIELDS) { + @legal_fields = grep { $_->name ne $field } @legal_fields; } } - if ($params->param('keywords')) { - my $t = $params->param('keywords_type'); - if (!$t || $t eq "or") { - $t = "anywords"; + foreach my $field ($params->param()) { + if (grep { $_->name eq $field } @legal_fields) { + my $type = $params->param("${field}_type"); + if (!$type) { + if ($field eq 'keywords') { + $type = 'anywords'; + } + else { + $type = 'anyexact'; + } + } + $type = 'matches' if $field eq 'content'; + push(@specialchart, [$field, $type, + join(',', $params->param($field))]); } - push(@specialchart, ["keywords", $t, $params->param('keywords')]); } foreach my $id ("1", "2") { @@ -574,10 +577,6 @@ sub init { } } - if (defined $params->param('content')) { - push(@specialchart, ['content', 'matches', $params->param('content')]); - } - my $multi_fields = join('|', map($_->name, @multi_select_fields)); my $chartid; |