diff options
Diffstat (limited to 'rt/share/html/Helpers/Autocomplete/Groups')
-rw-r--r-- | rt/share/html/Helpers/Autocomplete/Groups | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/rt/share/html/Helpers/Autocomplete/Groups b/rt/share/html/Helpers/Autocomplete/Groups index 1f4043fc6..7e694844b 100644 --- a/rt/share/html/Helpers/Autocomplete/Groups +++ b/rt/share/html/Helpers/Autocomplete/Groups @@ -45,12 +45,12 @@ %# those contributions and any derivatives thereof. %# %# END BPS TAGGED BLOCK }}} -% $r->content_type('application/json'); +% $r->content_type('application/json; charset=utf-8'); <% JSON( \@suggestions ) |n %> % $m->abort; <%ARGS> $term => undef -$max => 10 +$max => undef $exclude => '' $op => 'LIKE' </%ARGS> @@ -66,6 +66,9 @@ $m->abort unless $CurrentUser->Privileged; # Sanity check the operator $op = 'LIKE' unless $op =~ /^(?:LIKE|(?:START|END)SWITH|=|!=)$/i; +$m->callback( CallbackName => 'ModifyMaxResults', max => \$max ); +$max //= 10; + my $groups = RT::Groups->new( $CurrentUser ); $groups->RowsPerPage( $max ); $groups->LimitToUserDefinedGroups(); @@ -73,6 +76,7 @@ $groups->Limit( FIELD => 'Name', OPERATOR => $op, VALUE => $term, + CASESENSITIVE => 0, ); # Exclude groups we don't want @@ -83,6 +87,8 @@ foreach (split /\s*,\s*/, $exclude) { my @suggestions; while ( my $group = $groups->Next ) { - push @suggestions, { label => $group->Name, value => $group->Name, id => $group->id }; + my $suggestion = { id => $group->Id, label => $group->Name, value => $group->Name }; + $m->callback( CallbackName => "ModifySuggestion", suggestion => $suggestion, group => $group ); + push @suggestions, $suggestion; } </%INIT> |