From d0572fee8bcf0427901341ba7e9cd24db7162481 Mon Sep 17 00:00:00 2001 From: Thomas Berezansky Date: Tue, 18 Oct 2011 15:10:07 -0400 Subject: [PATCH] Obey renewal rules for SIP2 Checkout If local policy OR the selfcheck are set to not do renewals than don't attempt them. Also, return whether a renewal was attempted (success or failure) so that the self check on the other end has a better clue what went on. Signed-off-by: Thomas Berezansky Signed-off-by: Mike Rylander --- Open-ILS/src/perlmods/lib/OpenILS/SIP.pm | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/SIP.pm b/Open-ILS/src/perlmods/lib/OpenILS/SIP.pm index a6d3aab2bb..3a82c79750 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/SIP.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/SIP.pm @@ -283,7 +283,7 @@ sub checkin_ok { } sub renew_ok { - return to_bool($config->{policy}->{renew}); + return to_bool($config->{policy}->{renewal}); } sub status_update_ok { @@ -309,7 +309,8 @@ sub offline_ok { sub checkout { my ($self, $patron_id, $item_id, $sc_renew, $fee_ack) = @_; - $sc_renew = 0; + # In order to allow renewals the selfcheck AND the config have to say they are allowed + $sc_renew = (chr($sc_renew) eq 'Y' && $self->renew_ok()); $self->verify_session; @@ -340,13 +341,23 @@ sub checkout { syslog('LOG_DEBUG', "OILS: OpenILS::Checkout data loaded OK, checking out..."); if ($item->{patron} && ($item->{patron} eq $patron_id)) { - syslog('LOG_INFO', "OILS: OpenILS::Checkout data loaded OK, doing renew..."); - $sc_renew = 1; + $xact->renew_ok(1); # So that accept/reject responses have the correct value later + if($sc_renew) { + syslog('LOG_INFO', "OILS: OpenILS::Checkout data loaded OK, doing renew..."); + } else { + syslog('LOG_INFO', "OILS: OpenILS::Checkout appears to be renew, but renewal disallowed..."); + $xact->screen_msg("Renewals not permitted"); + $xact->ok(0); + return $xact; # Don't attempt later + } } elsif ($item->{patron} && ($item->{patron} ne $patron_id)) { # I can't deal with this right now # XXX check in then check out? $xact->screen_msg("Item checked out to another patron"); $xact->ok(0); + return $xact; # Don't wipe out the screen message later + } else { + $sc_renew = 0; } # Check for fee and $fee_ack. If there is a fee, and $fee_ack -- 2.11.0