From: Jeff Godin Date: Fri, 16 Nov 2012 21:23:19 +0000 (-0500) Subject: Enable clearing of an alias via OPAC X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=a0346ec048c57f78139cac6791d1e323da34a3db;p=evergreen%2Ftadl.git Enable clearing of an alias via OPAC Enable clearing of the user's holdshelf alias via the OPAC. Signed-off-by: Jeff Godin --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm index 39a62eab67..93cab87c03 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm @@ -1474,23 +1474,30 @@ sub update_passwd { $db_user->usrname($new_val); } elsif( $api =~ /alias/o ) { - - my $exist = $e->search_actor_user( - { alias => { - "=" => { - transform => "evergreen.lowercase", - value => lc($new_val) + # if we are attempting to set an alias, perform a case-insensitive + # search and reject if duplicate. + # XXX: make this configurable at some level + if ($new_val && $new_val ne '') { + my $exist = $e->search_actor_user( + { alias => { + "=" => { + transform => "evergreen.lowercase", + value => lc($new_val) + } } - } - }, - { idlist => 1 } - ); + }, + { idlist => 1 } + ); - if (@$exist) { - $e->rollback; - return new OpenILS::Event('USERNAME_EXISTS'); + if (@$exist) { + $e->rollback; + return new OpenILS::Event('USERNAME_EXISTS'); + } + $db_user->alias($new_val); + } else { + # we were provided with an empty value -- clear the alias + $db_user->clear_alias; } - $db_user->alias($new_val); } elsif( $api =~ /email/o ) { $db_user->email($new_val); diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm index 2e8c5af3c3..1497ce327a 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm @@ -1829,11 +1829,6 @@ sub load_myopac_update_alias { return Apache2::Const::OK unless $self->cgi->request_method eq 'POST'; - unless($alias) { - $ctx->{invalid_alias} = $alias; - return Apache2::Const::OK; - } - if($alias ne $e->requestor->alias) { my $evt = $U->simplereq(