From: lmcfarland Date: Wed, 8 Jul 2009 17:21:47 +0000 (+0000) Subject: added functionality of searching for patron via barcode or rdbms-given id, changes... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=1ae24460fe4c7c593181bbcc50df38d43f205743;p=evergreen%2Fbjwebb.git added functionality of searching for patron via barcode or rdbms-given id, changes are inactive by default, setting id_as_barcode to true will enable. git-svn-id: svn://svn.open-ils.org/ILS/trunk@13531 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/examples/opensrf.xml.example b/Open-ILS/examples/opensrf.xml.example index 6d5824700..c56b854a1 100644 --- a/Open-ILS/examples/opensrf.xml.example +++ b/Open-ILS/examples/opensrf.xml.example @@ -428,6 +428,11 @@ vim:et:ts=4:sw=4: 1 5 + + + false + + diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm b/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm index 1a37e6bbe..bd86bf037 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm @@ -2975,18 +2975,32 @@ sub retrieve_usr_id_via_barcode_or_usrname { my($self, $conn, $auth, $barcode, $username) = @_; my $e = new_editor(authtoken => $auth); return $e->die_event unless $e->checkauth; + my $id_as_barcode= OpenSRF::Utils::SettingsClient->new->config_value(apps => 'open-ils.actor' => app_settings => 'id_as_barcode'); my $user; my $user_by_barcode; my $user_by_username; + $logger->info("$id_as_barcode is the ID as BARCODE"); if($barcode) { my $card = $e->search_actor_card([ {barcode => $barcode}, - {flesh => 1, flesh_fields => {ac => ['usr']}}])->[0] or return OpenILS::Event->new( 'ACTOR_USER_NOT_FOUND' ); - $user_by_barcode = $card->usr; - $user = $user_by_barcode; + {flesh => 1, flesh_fields => {ac => ['usr']}}])->[0]; + if ($id_as_barcode =~ /^t/i) { + if (!$card) { + $user = $e->retrieve_actor_user($barcode); + return OpenILS::Event->new( 'ACTOR_USER_NOT_FOUND' ) if(!$user); + }else { + $user_by_barcode = $card->usr; + $user = $user_by_barcode; + } + }else { + return OpenILS::Event->new( 'ACTOR_USER_NOT_FOUND' ) if(!$card); + $user_by_barcode = $card->usr; + $user = $user_by_barcode; + } } + if ($username) { - $user_by_username = $e->search_actor_user({usrname => $username})->[0] or return OpenILS::Event->new( 'ACTOR_USER_NOT_FOUND' ); + $user_by_username = $e->search_actor_user({usrname => $username})->[0] or return OpenILS::Event->new( 'ACTOR_USR_NOT_FOUND' ); $user = $user_by_username; }