[Koha-patches] [PATCH] Bug 4361 Return Patron Expired to Sip Process

Colin Campbell colin.campbell at ptfs-europe.com
Wed Apr 7 10:58:49 CEST 2010


Identify Patron Expiry so that it is returned in Patron Info Response
---
 C4/SIP/ILS/Patron.pm |   25 ++++++++++++++++++++-----
 1 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/C4/SIP/ILS/Patron.pm b/C4/SIP/ILS/Patron.pm
index 386287b..2a73307 100644
--- a/C4/SIP/ILS/Patron.pm
+++ b/C4/SIP/ILS/Patron.pm
@@ -50,6 +50,15 @@ sub new {
 	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;
+    if ($expired) {
+        if ($kp->{opacnote} ) {
+            $kp->{opacnote} .= q{ };
+        }
+        $kp->{opacnote} .= 'PATRON EXPIRED';
+    }
 	my %ilspatron;
 	my $adr     = $kp->{streetnumber} || '';
 	my $address = $kp->{address}      || ''; 
@@ -74,10 +83,10 @@ sub new {
         address         => $adr,
         home_phone      => $kp->{phone},
         email_addr      => $kp->{email},
-        charge_ok       => ( !$debarred ),
-        renew_ok        => ( !$debarred ),
-        recall_ok       => ( !$debarred ),
-        hold_ok         => ( !$debarred ),
+        charge_ok       => ( !$debarred && !$expired ),
+        renew_ok        => ( !$debarred && !$expired ),
+        recall_ok       => ( !$debarred && !$expired ),
+        hold_ok         => ( !$debarred && !$expired ),
         card_lost       => ( $kp->{lost} || $kp->{gonenoaddress} || $flags->{LOST} ),
         claims_returned => 0,
         fines           => $fines_amount, # GetMemberAccountRecords($kp->{borrowernumber})
@@ -92,7 +101,8 @@ sub new {
         fine_items      => [],
         recall_items    => [],
         unavail_holds   => [],
-        inet            => ( !$debarred ),
+        inet            => ( !$debarred && !$expired ),
+        expired         => $expired,
     );
     }
     $debug and warn "patron fines: $ilspatron{fines} ... amountoutstanding: $kp->{amountoutstanding} ... CHARGES->amount: $flags->{CHARGES}->{amount}";
@@ -205,6 +215,11 @@ sub language {
     return $self->{language} || '000'; # Unspecified
 }
 
+sub expired {
+    my $self = shift;
+    return $self->{expired};
+}
+
 #
 # remove the hold on item item_id from my hold queue.
 # return true if I was holding the item, false otherwise.
-- 
1.6.6.1




More information about the Koha-patches mailing list