[open-ils-commits] r13531 - in trunk/Open-ILS: examples src/perlmods/OpenILS/Application (lmcfarland)
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Jul 8 13:21:50 EDT 2009
Author: lmcfarland
Date: 2009-07-08 13:21:47 -0400 (Wed, 08 Jul 2009)
New Revision: 13531
Modified:
trunk/Open-ILS/examples/opensrf.xml.example
trunk/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm
Log:
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.
Modified: trunk/Open-ILS/examples/opensrf.xml.example
===================================================================
--- trunk/Open-ILS/examples/opensrf.xml.example 2009-07-08 15:49:36 UTC (rev 13530)
+++ trunk/Open-ILS/examples/opensrf.xml.example 2009-07-08 17:21:47 UTC (rev 13531)
@@ -428,6 +428,11 @@
<min_spare_children>1</min_spare_children>
<max_spare_children>5</max_spare_children>
</unix_config>
+ <!-- set this to 'true' to have barcode search also search patron records by unique ID -->
+ <app_settings>
+ <id_as_barcode>false</id_as_barcode>
+ </app_settings>
+
</open-ils.actor>
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm 2009-07-08 15:49:36 UTC (rev 13530)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm 2009-07-08 17:21:47 UTC (rev 13531)
@@ -2975,18 +2975,32 @@
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;
}
More information about the open-ils-commits
mailing list