X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=rt%2Fshare%2Fhtml%2FHelpers%2FAutocomplete%2FGroups;h=7cfd6188ea6c473eabd8507c4a3da6a88871397d;hp=a7de30a6da2b7e04319879fa26757a8c7abce97d;hb=de9d037528895f7151a9aead6724ce2df95f9586;hpb=e9e0cf0989259b94d9758eceff448666a2e5a5cc diff --git a/rt/share/html/Helpers/Autocomplete/Groups b/rt/share/html/Helpers/Autocomplete/Groups index a7de30a6d..7cfd6188e 100644 --- a/rt/share/html/Helpers/Autocomplete/Groups +++ b/rt/share/html/Helpers/Autocomplete/Groups @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2014 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2017 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -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' @@ -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; }