summaryrefslogtreecommitdiff
path: root/rt/share/html/Helpers/Autocomplete/Groups
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2015-07-09 22:18:55 -0700
committerIvan Kohler <ivan@freeside.biz>2015-07-09 22:18:55 -0700
commit1c538bfabc2cd31f27067505f0c3d1a46cba6ef0 (patch)
tree96922ad4459eda1e649327fd391d60c58d454c53 /rt/share/html/Helpers/Autocomplete/Groups
parent4f5619288413a185e9933088d9dd8c5afbc55dfa (diff)
RT 4.2.11, ticket#13852
Diffstat (limited to 'rt/share/html/Helpers/Autocomplete/Groups')
-rw-r--r--rt/share/html/Helpers/Autocomplete/Groups12
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>