From 86d6af6970a887fa12ee65aacdb9086836d773fd Mon Sep 17 00:00:00 2001 From: Max Kanat-Alexander Date: Tue, 1 Mar 2011 07:19:05 -0800 Subject: Bug 616341: Make "tag" a valid search field in Search.pm, for the new tagging system r=mkanat, a=mkanat (module owner) --- Bugzilla/Search.pm | 53 ++++++++++++++++++++++++----------------------------- 1 file changed, 24 insertions(+), 29 deletions(-) (limited to 'Bugzilla/Search.pm') diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm index 34100b4ba..3af5b98cd 100644 --- a/Bugzilla/Search.pm +++ b/Bugzilla/Search.pm @@ -220,6 +220,22 @@ use constant NON_NUMERIC_OPERATORS => qw( notregexp ); +use constant MULTI_SELECT_OVERRIDE => { + notequals => \&_multiselect_negative, + notregexp => \&_multiselect_negative, + notsubstring => \&_multiselect_negative, + nowords => \&_multiselect_negative, + nowordssubstr => \&_multiselect_negative, + + allwords => \&_multiselect_multiple, + allwordssubstr => \&_multiselect_multiple, + anyexact => \&_multiselect_multiple, + anywords => \&_multiselect_multiple, + anywordssubstr => \&_multiselect_multiple, + + _non_changed => \&_multiselect_nonchanged, +}; + use constant OPERATOR_FIELD_OVERRIDE => { # User fields 'attachments.submitter' => { @@ -281,21 +297,7 @@ use constant OPERATOR_FIELD_OVERRIDE => { dependson => { _non_changed => \&_dependson_nonchanged, }, - keywords => { - notequals => \&_multiselect_negative, - notregexp => \&_multiselect_negative, - notsubstring => \&_multiselect_negative, - nowords => \&_multiselect_negative, - nowordssubstr => \&_multiselect_negative, - - allwords => \&_multiselect_multiple, - allwordssubstr => \&_multiselect_multiple, - anyexact => \&_multiselect_multiple, - anywords => \&_multiselect_multiple, - anywordssubstr => \&_multiselect_multiple, - - _non_changed => \&_multiselect_nonchanged, - }, + keywords => MULTI_SELECT_OVERRIDE, 'flagtypes.name' => { _default => \&_flagtypes_name, }, @@ -323,25 +325,13 @@ use constant OPERATOR_FIELD_OVERRIDE => { lessthaneq => \&_owner_idle_time_greater_less, _default => \&_invalid_combination, }, - product => { _non_changed => \&_product_nonchanged, }, + tag => MULTI_SELECT_OVERRIDE, # Custom multi-select fields - _multi_select => { - notequals => \&_multiselect_negative, - notregexp => \&_multiselect_negative, - notsubstring => \&_multiselect_negative, - nowords => \&_multiselect_negative, - nowordssubstr => \&_multiselect_negative, - - allwords => \&_multiselect_multiple, - allwordssubstr => \&_multiselect_multiple, - anyexact => \&_multiselect_multiple, - - _non_changed => \&_multiselect_nonchanged, - }, + _multi_select => MULTI_SELECT_OVERRIDE, # Timetracking Fields percentage_complete => { @@ -2693,6 +2683,11 @@ sub _multiselect_table { return "keywords INNER JOIN keyworddefs". " ON keywords.keywordid = keyworddefs.id"; } + elsif ($field eq 'tag') { + $args->{full_field} = 'tags.name'; + return "bug_tag INNER JOIN tags ON bug_tag.tag_id = tags.id" + . " AND user_id = " . $self->_user->id; + } my $table = "bug_$field"; $args->{full_field} = "bug_$field.value"; return $table; -- cgit v1.2.3-24-g4f1b