From e9ac8e62c113eecd7c5a69f3e1f7baec53044146 Mon Sep 17 00:00:00 2001 From: Matthias Meusburger Date: Thu, 17 Oct 2019 10:32:18 +0200 Subject: [PATCH] Bug 25815: SIP Checkout: add more information on why the patron is blocked. Currently, on SIP checkout, Koha only returns "Patron Blocked" when there is a problem with the patron. This patch adds more specific informations, with the following messages: - "Patron expired" - "Patron debarred" - "Patron has fines" (see system preference "noissuescharge") - "Patron blocked" (see system preference "OverduesBlockCirc") Test plan: - Try to do a SIP checkout with a patron that is in one of the above situations. - Check that the displayed message matches the patron's situation. Signed-off-by: Sonia --- C4/SIP/ILS.pm | 12 +++++++++--- C4/SIP/ILS/Patron.pm | 4 ++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/C4/SIP/ILS.pm b/C4/SIP/ILS.pm index 145fe89aac..f24c8d8d2f 100644 --- a/C4/SIP/ILS.pm +++ b/C4/SIP/ILS.pm @@ -123,7 +123,6 @@ sub offline_ok { sub checkout { my ( $self, $patron_id, $item_id, $sc_renew, $fee_ack, $account ) = @_; my ( $patron, $item, $circ ); - $circ = C4::SIP::ILS::Transaction::Checkout->new(); # BEGIN TRANSACTION @@ -132,12 +131,19 @@ sub checkout { if ($fee_ack) { $circ->fee_ack($fee_ack); } - if ( !$patron ) { $circ->screen_msg("Invalid Patron"); } elsif ( !$patron->charge_ok ) { - $circ->screen_msg("Patron Blocked"); + if ($patron->expired) { + $circ->screen_msg("Patron expired"); + } elsif ($patron->debarred) { + $circ->screen_msg("Patron debarred"); + } elsif ($patron->fine_blocked) { + $circ->screen_msg("Patron has fines"); + } else { + $circ->screen_msg("Patron blocked"); + } } elsif ( !$item ) { $circ->screen_msg("Invalid Item"); diff --git a/C4/SIP/ILS/Patron.pm b/C4/SIP/ILS/Patron.pm index 95166d3da8..7d77b7e9be 100644 --- a/C4/SIP/ILS/Patron.pm +++ b/C4/SIP/ILS/Patron.pm @@ -126,7 +126,9 @@ sub new { recall_items => [], unavail_holds => [], inet => ( !$debarred && !$expired ), + debarred => $debarred, expired => $expired, + fine_blocked => $fine_blocked, fee_limit => $fee_limit, userid => $kp->{userid}, ); @@ -181,6 +183,8 @@ my %fields = ( birthdate_iso => 0, dateexpiry => 0, dateexpiry_iso => 0, + debarred => 0, + fine_blocked => 0, ptype => 0, charge_ok => 0, # for patron_status[0] (inverted) renew_ok => 0, # for patron_status[1] (inverted) -- 2.30.2