From 142cccdc4c91fa2f2dacb8f4dd5110e88b158b34 Mon Sep 17 00:00:00 2001 From: Colin Campbell Date: Wed, 7 Apr 2010 09:58:49 +0100 Subject: [PATCH] Bug 4361 Return Patron Expired to Sip Process Identify Patron Expiry so that it is returned in Patron Info Response Signed-off-by: Galen Charlton --- C4/SIP/ILS/Patron.pm | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/C4/SIP/ILS/Patron.pm b/C4/SIP/ILS/Patron.pm index 2410d94bba..e6b53b10f7 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} || ''; @@ -78,10 +87,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}) @@ -96,7 +105,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}"; @@ -211,6 +221,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. -- 2.39.5