diff options
author | Tiago Mello <timello@gmail.com> | 2010-08-24 23:03:20 +0200 |
---|---|---|
committer | Tiago Mello <timello@gmail.com> | 2010-08-24 23:03:20 +0200 |
commit | d94865b30a92be8a3a900f8d1d8262d36044b1ca (patch) | |
tree | 529e23fb497c5100c9e63432d6ddb7dc9e24058c /Bugzilla/Search.pm | |
parent | 85e75aba6a7131da9d63b1f628a27e986bb428c5 (diff) | |
download | bugzilla-d94865b30a92be8a3a900f8d1d8262d36044b1ca.tar.gz bugzilla-d94865b30a92be8a3a900f8d1d8262d36044b1ca.tar.xz |
Bug 583243: Add a new hook 'search_operator_field_override'.
r/a=mkanat
Diffstat (limited to 'Bugzilla/Search.pm')
-rw-r--r-- | Bugzilla/Search.pm | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm index cde1f8e35..0a5b5eb22 100644 --- a/Bugzilla/Search.pm +++ b/Bugzilla/Search.pm @@ -1597,16 +1597,17 @@ sub do_search_function { return if $args->{term}; } - my $override = OPERATOR_FIELD_OVERRIDE->{$actual_field}; + my $operator_field_override = $self->_get_operator_field_override(); + my $override = $operator_field_override->{$actual_field}; if (!$override) { # Multi-select fields get special handling. if ($self->_multi_select_fields->{$actual_field}) { - $override = OPERATOR_FIELD_OVERRIDE->{_multi_select}; + $override = $operator_field_override->{_multi_select}; } # And so do attachment fields, if they don't have a specific # individual override. elsif ($actual_field =~ /^attachments\./) { - $override = OPERATOR_FIELD_OVERRIDE->{attachments}; + $override = $operator_field_override->{attachments}; } } @@ -1671,6 +1672,22 @@ sub _pick_override_function { return $search_func; } +sub _get_operator_field_override { + my $self = shift; + my $cache = Bugzilla->request_cache; + + return $cache->{operator_field_override} + if defined $cache->{operator_field_override}; + + my %operator_field_override = %{ OPERATOR_FIELD_OVERRIDE() }; + Bugzilla::Hook::process('search_operator_field_override', + { search => $self, + operators => \%operator_field_override }); + + $cache->{operator_field_override} = \%operator_field_override; + return $cache->{operator_field_override}; +} + ########################### # Search Function Helpers # ########################### |