Make patron alias unique test case insensitive
authorJeff Godin <jgodin@tadl.org>
Thu, 23 Aug 2012 18:39:26 +0000 (14:39 -0400)
committerJeff Godin <jgodin@tadl.org>
Thu, 26 Dec 2013 19:10:19 +0000 (14:10 -0500)
When testing a patron alias to determine if it is unique, ensure
that the comparison is done without regard for case.

Case is preserved, but when searching for an existing matching
alias, both values are lowercased using evergreen.lowercase().

Signed-off-by: Jeff Godin <jgodin@tadl.org>
Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm

index 61d30f4..6db0bdb 100644 (file)
@@ -1440,7 +1440,17 @@ sub update_passwd {
 
         } elsif( $api =~ /alias/o ) {
 
-            my $exist = $e->search_actor_user({alias=>$new_val},{idlist=>1});
+            my $exist = $e->search_actor_user(
+                { alias => {
+                    "=" => {
+                        transform => "evergreen.lowercase",
+                        value     => lc($new_val)
+                        }
+                    }
+                },
+                { idlist => 1 }
+            );
+
             if (@$exist) {
                 $e->rollback;
                 return new OpenILS::Event('USERNAME_EXISTS');