diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 7fdc2cce50..682317da47 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -3267,9 +3267,11 @@ sub CanBookBeRenewed { && $issuing_rule->{unseen_renewals_allowed} == ( $issue->unseen_renewals + 1 ) ) ? 1 : 0; my $overduesblockrenewing = C4::Context->preference('OverduesBlockRenewing'); + my $finesblockrenewing = C4::Context->preference("FineNoRenewals"); my $restrictionblockrenewing = C4::Context->preference('RestrictionBlockRenewing'); my $restricted = $patron->is_debarred; my $hasoverdues = $patron->has_overdues; + my $balance = $patron->account->balance; if ( $restricted and $restrictionblockrenewing ) { return ( 0, 'restriction' ); @@ -3277,6 +3279,8 @@ sub CanBookBeRenewed { || ( $issue->is_overdue and $overduesblockrenewing eq 'blockitem' ) ) { return ( 0, 'overdue' ); + } elsif ( $finesblockrenewing && $balance > $finesblockrenewing ) { + return ( 0, 'too_much_oweing'); } } diff --git a/circ/renew.pl b/circ/renew.pl index 250b3c1219..5d8446776d 100755 --- a/circ/renew.pl +++ b/circ/renew.pl @@ -68,9 +68,6 @@ if ( $op eq 'cud-renew' && $barcode ) { $patron = $checkout->patron; my $borrowernumber = $patron->borrowernumber; - $balance = $patron->account->balance; - my $amountlimit = C4::Context->preference("FineNoRenewals"); - if ( ( $patron->is_debarred || q{} ) lt dt_from_string()->ymd() ) { my $confirmations; my $can_renew; @@ -98,12 +95,15 @@ if ( $op eq 'cud-renew' && $barcode ) { ); } - if ( $balance > $amountlimit ) { - $error = "too_much_debt"; - $can_renew = 0; + if ( $error && ($error eq 'too_much_oweing' or $error eq 'auto_too_much_oweing') ) { if ($override_debt) { $can_renew = 1; - $error = undef; + $error = undef; + } + else { + $balance = $patron->account->balance; + $template->param( balance => $balance ); + $can_renew = 0; } } @@ -142,7 +142,6 @@ if ( $op eq 'cud-renew' && $barcode ) { error => $error, soonestrenewdate => $soonest_renew_date, latestautorenewdate => $latest_auto_renew_date, - balance => $balance, ); } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt index 3ea9b86281..227798df45 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt @@ -139,7 +139,7 @@ [% END %] - [% ELSIF error == "too_much_debt" %] + [% ELSIF error == "too_much_oweing" %]