Merge branch 'master' of https://github.com/jgoodman/Freeside
[freeside.git] / rt / share / html / Helpers / Autocomplete / Users
index c2b92c1..8f7425f 100644 (file)
@@ -2,7 +2,7 @@
 %#
 %# COPYRIGHT:
 %#
-%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
+%# This software is Copyright (c) 1996-2014 Best Practical Solutions, LLC
 %#                                          <sales@bestpractical.com>
 %#
 %# (Except where explicitly superseded by other copyright notices)
@@ -111,13 +111,27 @@ while (my ($name, $op) = each %fields) {
 
 # Exclude users we don't want
 foreach (split /\s*,\s*/, $exclude) {
-    $users->Limit(FIELD => 'id', VALUE => $_, OPERATOR => '!=');
+    $users->Limit(FIELD => 'id', VALUE => $_, OPERATOR => '!=', ENTRYAGGREGATOR => 'AND');
 }
 
 my @suggestions;
 
-$users->Limit( FIELD => $return, OPERATOR => '!=', VALUE => '' );
-$users->Limit( FIELD => $return, OPERATOR => 'IS NOT', VALUE => 'NULL', ENTRYAGGREGATOR => 'AND'  );
+if ( RT->Config->Get('DatabaseType') eq 'Oracle' ) {
+    $users->Limit(
+        FIELD    => $return,
+        OPERATOR => 'IS NOT',
+        VALUE    => 'NULL',
+    );
+}
+else {
+    $users->Limit( FIELD => $return, OPERATOR => '!=', VALUE => '' );
+    $users->Limit(
+        FIELD           => $return,
+        OPERATOR        => 'IS NOT',
+        VALUE           => 'NULL',
+        ENTRYAGGREGATOR => 'AND'
+    );
+}
 
 while ( my $user = $users->Next ) {
     next if $user->id == RT->SystemUser->id
@@ -125,7 +139,7 @@ while ( my $user = $users->Next ) {
 
     my $formatted = $m->scomp('/Elements/ShowUser', User => $user, NoEscape => 1);
     $formatted =~ s/\n//g;
-    my $suggestion = { label => $formatted, value => $user->$return };
+    my $suggestion = { label => $formatted, value => $user->$return, id => $user->id };
     $m->callback( CallbackName => "ModifySuggestion", suggestion => $suggestion, user => $user );
     push @suggestions, $suggestion;
 }