[Koha-patches] [PATCH 2/4] SIP Fixing debarment management

paul.poulain at biblibre.com paul.poulain at biblibre.com
Wed Jan 19 21:38:59 CET 2011


From: Henri-Damien LAURENT <henridamien.laurent at biblibre.com>

debarred is now a date.
We have to use the calculated flag DEBARRED rather than simply looking at the debarred field
---
 C4/SIP/ILS/Patron.pm |   31 ++++++++++++++++---------------
 1 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/C4/SIP/ILS/Patron.pm b/C4/SIP/ILS/Patron.pm
index 3f4e136..e8f9c63 100644
--- a/C4/SIP/ILS/Patron.pm
+++ b/C4/SIP/ILS/Patron.pm
@@ -38,21 +38,22 @@ sub new {
 	my ($class, $patron_id) = @_;
     my $type = ref($class) || $class;
     my $self;
-	$kp = GetMember(cardnumber=>$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 undef;
-	}
-	$kp = GetMemberDetails(undef,$patron_id);
-	$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'"; 
-	my $debarred  = $kp->{debarred};  # 1 if ($kp->{flags}->{DBARRED}->{noissues});
-	$debug and warn sprintf("Debarred = %s : ", ($debarred||'undef')) . Dumper(%{$kp->{flags}});
-    my ($day, $month, $year) = (localtime)[3,4,5];
-    my $today    = sprintf '%04d-%02d-%02d', $year+1900, $month+1, $day;
-    my $expired  = ($today gt $kp->{dateexpiry}) ? 1 : 0;
+    $kp = GetMember( cardnumber => $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 undef;
+    }
+    $kp = GetMemberDetails( undef, $patron_id );
+    $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'";
+	my $debarred  = defined($kp->{flags}->{DEBARRED});  # 1 if ($kp->{flags}->{DBARRED}->{noissues});
+    $debug and warn sprintf( "Debarred = %s : ", ( $debarred || 'undef' ) ) . Dumper( %{ $kp->{flags} } );
+    my ( $day, $month, $year ) = (localtime)[ 3, 4, 5 ];
+    my $today = sprintf '%04d-%02d-%02d', $year + 1900, $month + 1, $day;
+    my $expired = ( $today gt $kp->{dateexpiry} ) ? 1 : 0;
+
     if ($expired) {
         if ($kp->{opacnote} ) {
             $kp->{opacnote} .= q{ };
-- 
1.7.1



More information about the Koha-patches mailing list