From b1a649e8ba578ad36c7014d44254c8ee44fc2d62 Mon Sep 17 00:00:00 2001 From: David Cook Date: Tue, 20 Nov 2012 07:46:13 +1100 Subject: [PATCH] Bug 9109 - Authenticate on userid as well as cardnumbe Content-Type: text/plain; charset="utf-8" Apparently, SIP currently only uses cardnumber to authenticate Koha patrons. This patch introduces a check for userid when authenticating, if the cardnumber isn't found. --- C4/SIP/ILS/Patron.pm | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/C4/SIP/ILS/Patron.pm b/C4/SIP/ILS/Patron.pm index d3a9762..13c4c7b 100644 --- a/C4/SIP/ILS/Patron.pm +++ b/C4/SIP/ILS/Patron.pm @@ -37,13 +37,18 @@ sub new { my ($class, $patron_id) = @_; my $type = ref($class) || $class; my $self; + #check both cardnumber and userid $kp = GetMember(cardnumber=>$patron_id); + if (defined $kp) { + } else { + $kp = GetMember(userid=>$patron_id); + } $debug and warn "new Patron (GetMember): " . Dumper($kp); unless (defined $kp) { syslog("LOG_DEBUG", "new ILS::Patron(%s): no such patron", $patron_id); return; } - $kp = GetMemberDetails(undef,$patron_id); + $kp = GetMemberDetails($kp->{'borrowernumber'}); $debug and warn "new Patron (GetMemberDetails): " . Dumper($kp); my $pw = $kp->{password}; ### FIXME - md5hash -- deal with . my $flags = $kp->{flags}; # or warn "Warning: No flags from patron object for '$patron_id'"; -- 1.7.7.4