Bugzilla – Attachment 185275 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: Add new syspref AllowFineOverrideRenewing
0006-Bug-23415-Add-new-syspref-AllowFineOverrideRenewing.patch (text/plain), 8.07 KB, created by
Emmi Takkinen
on 2025-08-08 12:20:03 UTC
(
hide
)
Description:
Bug 23415: Add new syspref AllowFineOverrideRenewing
Filename:
MIME Type:
Creator:
Emmi Takkinen
Created:
2025-08-08 12:20:03 UTC
Size:
8.07 KB
patch
obsolete
>From 212d96949dca9e8587f70326edb234bfc099972f Mon Sep 17 00:00:00 2001 >From: Emmi Takkinen <emmi.takkinen@koha-suomi.fi> >Date: Fri, 8 Aug 2025 15:07:24 +0300 >Subject: [PATCH 6/6] Bug 23415: Add new syspref AllowFineOverrideRenewing > >This patch adds new syspref AllowFineOverrideRenewing. It allows >staff to renew items for patrons whose fines are over limit set >in syspref FineNoRenewals. Otherwise renewing is prevented. If >renewing items is allowed staff is still required to confirm >if they really want to renew items for the patron. > >To test: >1. Apply this patch, update database and restart all services. >2. Find patron with fines over limit set in FineNoRenewals and >renewable items. >=> Note that renewing is prevented with message "Cannot renew, >he patron has a debt of..." >3. Set syspref AllowFineOverrideRenewing as "Allow". >=> Note that items can now be renewed and renewing them displays >confirmation pop-up. > >Sponsored-by: Koha-Suomi Oy >--- > C4/Circulation.pm | 15 ++++++++------- > installer/data/mysql/atomicupdate/bug_23415.pl | 13 +++++++++++-- > installer/data/mysql/mandatory/sysprefs.sql | 1 + > .../en/modules/admin/preferences/circulation.pref | 6 ++++++ > koha-tmpl/intranet-tmpl/prog/js/checkouts.js | 12 ++++++++++++ > 5 files changed, 38 insertions(+), 9 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index d696184a6d..fb7a0a686d 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -3173,12 +3173,13 @@ sub CanBookBeRenewed { > $final_unseen_renewal = ( C4::Context->preference('UnseenRenewals') > && $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; >+ my $overduesblockrenewing = C4::Context->preference('OverduesBlockRenewing'); >+ my $finesblockrenewing = C4::Context->preference("FineNoRenewals"); >+ my $restrictionblockrenewing = C4::Context->preference('RestrictionBlockRenewing'); >+ my $allowfineoverriderenewing = C4::Context->preference("AllowFineOverrideRenewing"); >+ my $restricted = $patron->is_debarred; >+ my $hasoverdues = $patron->has_overdues; >+ my $balance = $patron->account->balance; > > if ( $restricted and $restrictionblockrenewing ) { > return ( 0, 'restriction' ); >@@ -3186,7 +3187,7 @@ sub CanBookBeRenewed { > || ( $issue->is_overdue and $overduesblockrenewing eq 'blockitem' ) ) > { > return ( 0, 'overdue' ); >- } elsif ( $finesblockrenewing && $balance > $finesblockrenewing ) { >+ } elsif ( $finesblockrenewing && $balance > $finesblockrenewing && !$allowfineoverriderenewing ) { > return ( 0, 'too_much_oweing'); > } > >diff --git a/installer/data/mysql/atomicupdate/bug_23415.pl b/installer/data/mysql/atomicupdate/bug_23415.pl >index a4160f16ce..57a3bf9639 100755 >--- a/installer/data/mysql/atomicupdate/bug_23415.pl >+++ b/installer/data/mysql/atomicupdate/bug_23415.pl >@@ -2,17 +2,26 @@ use Modern::Perl; > > return { > bug_number => "23415", >- description => "Rename OPACFineNoRenewals", >+ description => "Rename OPACFineNoRenewals and add new syspref AllowFineOverrideRenewing", > up => sub { > my ($args) = @_; > my ( $dbh, $out ) = @$args{qw(dbh out)}; > > $dbh->do( > q{ >- UPDATE systempreferences SET variable = "FineNoRenewals", explanation = "Fine limit above which user or staff cannot renew items" WHERE variable = "OPACFineNoRenewals"; >+ UPDATE IGNORE systempreferences SET variable = "FineNoRenewals", explanation = "Fine limit above which user or staff cannot renew items" WHERE variable = "OPACFineNoRenewals"; > } > ); > > say $out "Updated system preference 'OPACFineNoRenewals'"; >+ >+ $dbh->do( >+ q{ >+ INSERT IGNORE INTO systempreferences (variable, value, options, explanation, type) >+ VALUES ('AllowFineOverrideRenewing', '0', '0', 'If on, staff will be able to renew items for patrons with fines greater than FineNoRenewals.','YesNo') >+ } >+ ); >+ >+ say $out "Added new system preference 'AllowFineOverrideRenewing'"; > }, > }; >diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql >index a2585f21dd..417017a3ef 100644 >--- a/installer/data/mysql/mandatory/sysprefs.sql >+++ b/installer/data/mysql/mandatory/sysprefs.sql >@@ -29,6 +29,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('AllowAllMessageDeletion','0','','Allow any Library to delete any message','YesNo'), > ('AllowCheckoutNotes', '0', NULL, 'Allow patrons to submit notes about checked out items.','YesNo'), > ('AllowFineOverride','0','0','If on, staff will be able to issue books to patrons with fines greater than noissuescharge.','YesNo'), >+('AllowFineOverrideRenewing','0','0','If on, staff will be able to renew items for patrons with fines greater than FineNoRenewals.','YesNo'), > ('AllowHoldDateInFuture','0','','If set a date field is displayed on the Hold screen of the Staff Interface, allowing the hold date to be set in the future.','YesNo'), > ('AllowHoldItemTypeSelection','0','','If enabled, patrons and staff will be able to select the itemtype when placing a hold','YesNo'), > ('AllowHoldPolicyOverride','0',NULL,'Allow staff to override hold policies when placing holds','YesNo'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >index d6bd0ba710..bf04a78ad0 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >@@ -263,6 +263,12 @@ Circulation: > 1: Allow > 0: "Don't allow" > - staff to manually override and check out items to patrons who have more in fines than set in the <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=noissuescharge">noissuescharge</a> system preference. >+ - >+ - pref: AllowFineOverrideRenewing >+ choices: >+ 1: Allow >+ 0: "Don't allow" >+ - staff to manually override and renew items for patrons who have more in fines than set in the <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=FineNoRenewals">FineNoRenewals</a> system preference. > - > - pref: AutomaticItemReturn > choices: >diff --git a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js >index 67881a0253..8770d97c40 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js >@@ -470,6 +470,18 @@ function LoadIssuesTable() { > __("Renewal denied by syspref") + > "</span>"; > >+ span_style = "display: none"; >+ span_class = "renewals-allowed"; >+ } else if ( >+ oObj.can_renew_error == "too_much_oweing" >+ ) { >+ msg += >+ "<span class='renewals-disabled'>" + >+ __( >+ "Cannot renew, he patron has a debt of " + parseFloat(oObj.fine).format_price() >+ ) + >+ "</span>"; >+ > span_style = "display: none"; > span_class = "renewals-allowed"; > } else { >-- >2.34.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