From a482e50fb489267d5062abfdcdda5141e6060d7a Mon Sep 17 00:00:00 2001 From: Alex Buckley Date: Fri, 31 Mar 2023 17:32:58 +0000 Subject: [PATCH] Bug 32602: SIP server doesn't respect IssuingInProcess system preference The system preference 'IssuingInProcess' when set to "Don't prevent" means patrons will still be allowed to issue items if their rental charge took the patron over the noissuescharge system preference. However, SIP returns that a patron is fine blocked (even if 'IssuingInProcess' equals "Don't prevent") when they try to issue items that take them over the noissuecharge amount. Test plan: 1. Configure the BK item type to have a rental charge of $2 2. Configure system preferences: - noissuescharge = $5 - IssuingInProcess = Don't prevent 3. From a SIP2 device issue 3 BK items to a borrower and notice after the 2nd item you cannot issue the third item 4. Apply patches 5. Restart your SIP2 server 6. From a SIP2 device issue 3 BK items to a different patron and notice you can issue all three items Sponsored-by: Horowhenua District Council, New Zealand --- C4/SIP/ILS.pm | 16 +++++++++------- C4/SIP/ILS/Patron.pm | 8 +++++--- C4/SIP/ILS/Transaction/Checkout.pm | 2 +- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/C4/SIP/ILS.pm b/C4/SIP/ILS.pm index 9bba3c80f5f..0d55d9a04b7 100644 --- a/C4/SIP/ILS.pm +++ b/C4/SIP/ILS.pm @@ -123,7 +123,7 @@ sub offline_ok { # sub checkout { my ( $self, $patron_id, $item_id, $sc_renew, $fee_ack, $account, $no_block_due_date ) = @_; - my ( $patron, $item, $circ ); + my ( $patron, $item, $circ, $message ); my @blocked_item_types; if (defined $account->{blocked_item_types}) { @blocked_item_types = split /\|/, $account->{blocked_item_types}; @@ -144,12 +144,14 @@ sub checkout { } elsif ($patron->expired) { $circ->screen_msg("Patron expired on " . output_pref({ dt => dt_from_string( $patron->dateexpiry_iso, 'iso' ), dateonly => 1 })); } elsif ($patron->fine_blocked) { - my $message = "Patron has fines"; - if ($account->{show_outstanding_amount}) { - my $patron_account = Koha::Account->new( { patron_id => $patron->{borrowernumber} }); - my $balance = $patron_account->balance; - if ($balance) { - $message .= (" - You owe " . Koha::Number::Price->new( $balance )->format({ with_symbol => 1}) . "."); + if ( !C4::Context->preference("IssuingInProcess") ) { + $message = "Patron has fines"; + if ($account->{show_outstanding_amount}) { + my $patron_account = Koha::Account->new( { patron_id => $patron->{borrowernumber} }); + my $balance = $patron_account->balance; + if ($balance) { + $message .= (" - You owe " . Koha::Number::Price->new( $balance )->format({ with_symbol => 1}) . "."); + } } } $circ->screen_msg($message); diff --git a/C4/SIP/ILS/Patron.pm b/C4/SIP/ILS/Patron.pm index 4b3e76f1a8c..70754e81aa5 100644 --- a/C4/SIP/ILS/Patron.pm +++ b/C4/SIP/ILS/Patron.pm @@ -87,8 +87,10 @@ sub new { my $fine_blocked = 0; my $noissueschargeguarantees = C4::Context->preference('NoIssuesChargeGuarantees'); if( $fines_amount > $fee_limit ){ - $fine_blocked = 1; - $fines_msg .= " -- " . "Patron blocked by fines" if $fine_blocked; + if ( !C4::Context->preference("IssuingInProcess") ) { + $fine_blocked = 1; + $fines_msg .= " -- " . "Patron blocked by fines" if $fine_blocked; + } } elsif ( $noissueschargeguarantorswithguarantees ) { $fines_amount += $patron->relationships_debt({ include_guarantors => 1, only_this_guarantor => 0, include_this_patron => 0 }); $fine_blocked ||= $fines_amount > $noissueschargeguarantorswithguarantees; @@ -158,7 +160,7 @@ sub new { if ($_ ne 'NOTES' and $flags->{$_}->{message}) { $ilspatron{screen_msg} .= " -- " . $flags->{$_}->{message}; # show all but internal NOTES } - if ($flags->{$_}->{noissues}) { + if ($flags->{$_}->{noissues} && !C4::Context->preference("IssuingInProcess")) { foreach my $toggle (qw(charge_ok renew_ok recall_ok hold_ok inet)) { $ilspatron{$toggle} = 0; # if we get noissues, disable everything } diff --git a/C4/SIP/ILS/Transaction/Checkout.pm b/C4/SIP/ILS/Transaction/Checkout.pm index c13e5682607..abb2f7447fa 100644 --- a/C4/SIP/ILS/Transaction/Checkout.pm +++ b/C4/SIP/ILS/Transaction/Checkout.pm @@ -141,7 +141,7 @@ sub do_checkout { } } - if ( $noerror == 0 && !$no_block_due_date ) { + if ( $noerror == 0 && !$no_block_due_date && !C4::Context->preference('IssuingInProcess') ) { $self->ok(0); return $self; } -- 2.30.2