From f877c58fcdd4beb882af6282c230dd298373d0fe 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. --- 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 7cff9c0579..65b6c88414 100644 --- a/C4/SIP/ILS.pm +++ b/C4/SIP/ILS.pm @@ -128,7 +128,6 @@ sub offline_ok { sub checkout { my ( $self, $patron_id, $item_id, $sc_renew, $fee_ack ) = @_; my ( $patron, $item, $circ ); - $circ = C4::SIP::ILS::Transaction::Checkout->new(); # BEGIN TRANSACTION @@ -137,12 +136,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 6969c115ed..3a9683d6e1 100644 --- a/C4/SIP/ILS/Patron.pm +++ b/C4/SIP/ILS/Patron.pm @@ -112,7 +112,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}, ); @@ -169,6 +171,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.11.0