From ea975176c42a7b98e4856db488f923c79c04c769 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 9 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 (restart_all will restart SIP) 10 - Try again 11 - Parent blocked, children should not be Signed-off-by: David Nind Signed-off-by: Marcel de Rooy Signed-off-by: Tomas Cohen Arazi (cherry picked from commit afec5139ff095a92c6ffb626e1a1a773328ac398) Signed-off-by: Matt Blenkinsop --- 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.39.5