Bugzilla – Attachment 188751 Details for
Bug 23415
Notify patron fines when renewing
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23415: (follow-up) Respect OPACFineNoRenewalsIncludeCredits preference
Bug-23415-follow-up-Respect-OPACFineNoRenewalsIncl.patch (text/plain), 3.63 KB, created by
Martin Renvoize (ashimema)
on 2025-10-31 06:58:47 UTC
(
hide
)
Description:
Bug 23415: (follow-up) Respect OPACFineNoRenewalsIncludeCredits preference
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2025-10-31 06:58:47 UTC
Size:
3.63 KB
patch
obsolete
>From f823c6c80ca863c6d12692a624dea42bcee7b555 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@openfifth.co.uk> >Date: Thu, 30 Oct 2025 22:04:17 +0000 >Subject: [PATCH] Bug 23415: (follow-up) Respect > OPACFineNoRenewalsIncludeCredits preference > >This patch fixes a regression introduced in the previous commits where >we changed FineNoRenewals checking to use non_issues_charges instead >of balance. While this change was correct for focusing on blocking >charges, we inadvertently removed the handling of the >OPACFineNoRenewalsIncludeCredits preference. > >The OPACFineNoRenewalsIncludeCredits preference controls whether >unapplied account credits should be included when calculating if a >patron exceeds the FineNoRenewals threshold. When this preference is >enabled, the patron's net balance (debits minus credits) should be >used instead of just their outstanding debits. > >This patch restores the preference handling for both: >1. Manual renewals in CanBookBeRenewed() >2. Auto renewals in _CanBookBeAutoRenewed() > >When OPACFineNoRenewalsIncludeCredits = 1: > Use balance (all charges net of credits) >When OPACFineNoRenewalsIncludeCredits = 0: > Use non_issues_charges (only blocking charges, no credits) > >This ensures that patrons with sufficient credits can renew their >items when the preference is enabled, while still maintaining the >focus on non-issuing charges introduced in the previous commits. > >Test plan: >1. Run prove t/db_dependent/Circulation.t >2. All tests should pass, particularly the > "auto_too_much_owing | OPACFineNoRenewalsBlockAutoRenew & > OPACFineNoRenewalsIncludeCredits" subtest > >Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> >--- > C4/Circulation.pm | 17 ++++++++++++----- > 1 file changed, 12 insertions(+), 5 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index dc04d65f17f..8326735adee 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -3246,6 +3246,10 @@ sub CanBookBeRenewed { > my $account = $patron->account; > my $balance = $account->balance; > my $non_issues_charges = $account->non_issues_charges; >+ my $amountoutstanding_for_renewal = >+ C4::Context->preference("OPACFineNoRenewalsIncludeCredits") >+ ? $balance >+ : $non_issues_charges; > > if ( $restricted and $restrictionblockrenewing ) { > return ( 0, 'restriction' ); >@@ -3253,7 +3257,7 @@ sub CanBookBeRenewed { > || ( $issue->is_overdue and $overduesblockrenewing eq 'blockitem' ) ) > { > return ( 0, 'overdue' ); >- } elsif ( $finesblockrenewing && $non_issues_charges > $finesblockrenewing ) { >+ } elsif ( $finesblockrenewing && $amountoutstanding_for_renewal > $finesblockrenewing ) { > return ( 0, 'too_much_owing' ); > } > >@@ -4990,10 +4994,13 @@ sub _CanBookBeAutoRenewed { > } > > if ( C4::Context->preference('OPACFineNoRenewalsBlockAutoRenew') ) { >- my $fine_no_renewals = C4::Context->preference("FineNoRenewals"); >- my $account = $patron->account; >- my $non_issues_charges = $account->non_issues_charges; >- if ( $non_issues_charges and $non_issues_charges > $fine_no_renewals ) { >+ my $fine_no_renewals = C4::Context->preference("FineNoRenewals"); >+ my $account = $patron->account; >+ my $amountoutstanding = >+ C4::Context->preference("OPACFineNoRenewalsIncludeCredits") >+ ? $account->balance >+ : $account->non_issues_charges; >+ if ( $amountoutstanding and $amountoutstanding > $fine_no_renewals ) { > return "auto_too_much_owing"; > } > } >-- >2.51.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 23415
:
92039
|
92541
|
98442
|
98634
|
98996
|
98997
|
105893
|
105894
|
108392
|
109871
|
109872
|
109876
|
109880
|
116919
|
116920
|
116921
|
116922
|
118175
|
118176
|
118177
|
118178
|
118183
|
119300
|
119301
|
119302
|
119303
|
121472
|
139670
|
139671
|
139672
|
139673
|
139674
|
146415
|
148198
|
148199
|
148200
|
148201
|
148202
|
152776
|
152777
|
152778
|
152779
|
152780
|
152781
|
154595
|
154596
|
154597
|
154598
|
154599
|
154600
|
158302
|
158303
|
158304
|
158305
|
158306
|
158307
|
161964
|
161965
|
161966
|
161967
|
161968
|
161969
|
162171
|
162172
|
162173
|
162174
|
162175
|
162176
|
162177
|
162178
|
162179
|
162180
|
171620
|
171621
|
171622
|
171623
|
171983
|
171984
|
171985
|
171986
|
172906
|
172907
|
172908
|
172909
|
172910
|
185270
|
185271
|
185272
|
185273
|
185274
|
185275
|
186014
|
188331
|
188332
|
188333
|
188334
|
188335
|
188336
|
188337
|
188338
|
188339
|
188340
|
188341
|
188342
|
188708
|
188709
|
188710
|
188711
|
188712
|
188713
|
188714
|
188715
|
188716
|
188717
|
188718
|
188719
|
188720
|
188738
|
188739
|
188740
|
188741
|
188742
|
188743
|
188744
|
188745
|
188746
|
188747
|
188748
|
188749
|
188750
| 188751