From 4dbc2c07da1f272234fe597e67ab54fa4523bb9d Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 7 Apr 2023 18:50:25 +0000 Subject: [PATCH] Bug 33411: Don't count related guarantees fees against NoIssuesChargeGuarantees To test: 1 - Find an adult patron in Koha 2 - Add two guarantees 3 - Add $1 fine to parent, $5 fine to each guarantee 4 - Set no issues charge guarantees to 10 5 - perl misc/sip_cli_emulator.pl -a localhost -p 6001 -su term1 -sp term1 -l CPL -m patron_information --patron BARCODE 6 - Note the 64 message starts with Y's that mean patron is blocked 7 - Repeat with each child barcode 8 - They are blocked? 9 - Apply patch, restart all 10 - Try again 11 - Parent blocked, children should not be --- C4/SIP/ILS/Patron.pm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/C4/SIP/ILS/Patron.pm b/C4/SIP/ILS/Patron.pm index 0aea8ab63c..33de77e387 100644 --- a/C4/SIP/ILS/Patron.pm +++ b/C4/SIP/ILS/Patron.pm @@ -93,9 +93,11 @@ sub new { $fine_blocked ||= $fines_amount > $noissueschargeguarantorswithguarantees; $fines_msg .= " -- " . "Patron blocked by fines ($fines_amount) on related accounts" if $fine_blocked; } elsif ( $noissueschargeguarantees ) { - $fines_amount += $patron->relationships_debt({ include_guarantors => 0, only_this_guarantor => 0, include_this_patron => 0 }); - $fine_blocked ||= $fines_amount > $noissueschargeguarantees; - $fines_msg .= " -- " . "Patron blocked by fines ($fines_amount) on guaranteed accounts" if $fine_blocked; + if( $patron->guarantee_relationships->count ){ + $fines_amount += $patron->relationships_debt({ include_guarantors => 0, only_this_guarantor => 1, include_this_patron => 0 }); + $fine_blocked ||= $fines_amount > $noissueschargeguarantees; + $fines_msg .= " -- " . "Patron blocked by fines ($fines_amount) on guaranteed accounts" if $fine_blocked; + } } my $circ_blocked =( C4::Context->preference('OverduesBlockCirc') ne "noblock" && defined $flags->{ODUES}->{itemlist} ) ? 1 : 0; -- 2.30.2