]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Allow extensions to alter quicksearch terms and search format. r=mkanat.
authorGervase Markham <gerv@gerv.net>
Thu, 27 Jan 2011 12:55:58 +0000 (12:55 +0000)
committerGervase Markham <gerv@mozilla.org>
Thu, 27 Jan 2011 12:55:58 +0000 (12:55 +0000)
https://bugzilla.mozilla.org/show_bug.cgi?id=621878

Bugzilla/Hook.pm
Bugzilla/Search/Quicksearch.pm
extensions/Example/Extension.pm

index de46f9a25cc8d39a356d92be874685f9b37a1e70..cf81e9c7d07c36c004dacb1489078f6668474a3c 100644 (file)
@@ -1136,6 +1136,21 @@ Params:
 
 =back
 
+=head2 quicksearch_map
+
+This hook allows you to alter the Quicksearch syntax to include e.g. special 
+searches for custom fields you have.
+
+Params:
+
+=over
+
+=item C<map> - a hash where the key is the name you want to use in 
+Quicksearch, and the value is the name from the C<fielddefs> table that you 
+want it to map to. You can modify existing mappings or add new ones.
+
+=back
+
 =head2 sanitycheck_check
 
 This hook allows for extra sanity checks to be added, for use by
index b2151ba3a88141c99744ef48befab64cd41cb108..340421bbb7ef404e97b7e1fa0ed18ddf1011b215 100644 (file)
@@ -101,6 +101,8 @@ sub FIELD_MAP {
                         status_whiteboard
                         cclist_accessible reporter_accessible)};
 
+    Bugzilla::Hook::process('quicksearch_map', {'map' => \%full_map} );
+
     $cache->{quicksearch_fields} = \%full_map;
 
     return $cache->{quicksearch_fields};
index 14bf6df8732394b3b150de3e751c739ee81b4e88..f56416559561a314b55533ce71724142a0829ba0 100644 (file)
@@ -649,6 +649,14 @@ sub product_end_of_create {
     }
 }
 
+sub quicksearch_map {
+    my ($self, $args) = @_;
+    my $map = $args->{'map'};
+
+    # This demonstrates adding a shorter alias for a long custom field name.
+    $map->{'impact'} = $map->{'cf_long_field_name_for_impact_field'};
+}
+
 sub sanitycheck_check {
     my ($self, $args) = @_;