From e3d3a237828769a797d391a51650b432fcf36492 Mon Sep 17 00:00:00 2001 From: Jason Etheridge Date: Wed, 4 Apr 2012 10:23:50 -0400 Subject: [PATCH] snapshot of /usr/local/share/perl/5.10.1/OpenILS/SIP/Patron.pm from asp-tadl-sip1 --- Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm | 27 ++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm b/Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm index 1f0ed7c3e4..58f72bd59d 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm @@ -79,10 +79,26 @@ sub new { $$usr_flesh{flesh} += 1; $$usr_flesh{flesh_fields}{ac} = ['usr']; - my $card = $e->search_actor_card([{barcode => $patron_id}, $usr_flesh])->[0]; + my $card = $e->search_actor_card([{barcode => $patron_id, active => 't'}, $usr_flesh])->[0]; + + if(!$card) { + if ($patron_id =~ /^[A-Z].*/i) { + syslog("LOG_WARNING", "Trying lowercased/transformed value for barcode: $patron_id"); + my $bc = lc($patron_id); + if (length($bc) == 25) { + $bc = substr($bc, 0, 13); + } elsif (length($bc) == 23) { + $bc = substr($bc, 0, 12); + } + $card = $e->search_actor_card([{barcode => $bc, active => 't'}, $usr_flesh])->[0]; + } else { + syslog("LOG_WARNING", "No such patron barcode: $patron_id"); + return undef; + } + } - if(!$card) { - syslog("LOG_WARNING", "No such patron barcode: $patron_id"); + if (!$card) { + syslog("LOG_WARNING", "Failed even after lowercase/transformed attempt, barcode: $patron_id"); return undef; } @@ -361,8 +377,9 @@ sub screen_msg { return $b if $u->standing_penalties and @{$u->standing_penalties}; # has the patron account expired? - my $expire = DateTime::Format::ISO8601->new->parse_datetime(cleanse_ISO8601($u->expire_date)); - return $b if CORE::time > $expire->epoch; + # GMC 2012-02-12 - let expired cards work + #my $expire = DateTime::Format::ISO8601->new->parse_datetime(cleanse_ISO8601($u->expire_date)); + #return $b if CORE::time > $expire->epoch; return 'OK'; } -- 2.11.0