Bugzilla – Attachment 162175 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: Rename OPACFineNoRenewals
Bug-23415-Rename-OPACFineNoRenewals.patch (text/plain), 14.35 KB, created by
Martin Renvoize (ashimema)
on 2024-02-15 08:04:05 UTC
(
hide
)
Description:
Bug 23415: Rename OPACFineNoRenewals
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-02-15 08:04:05 UTC
Size:
14.35 KB
patch
obsolete
>From 0dd5fe9c0ac28bb2579163c12c792e0bbfa7c6a1 Mon Sep 17 00:00:00 2001 >From: Emmi Takkinen <emmi.takkinen@koha-suomi.fi> >Date: Fri, 28 May 2021 11:04:16 +0300 >Subject: [PATCH] Bug 23415: Rename OPACFineNoRenewals > >OPACFineNoRenewals no longer applies just to OPAC. >To avoid confusion rename it as FineNoRenewals and >also rename all occurences in code. > >To test, confirm everything works as described in >previous test plans. > >Also prove t/db_dependent/Circulation.t > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > C4/Circulation.pm | 2 +- > circ/renew.pl | 2 +- > installer/data/mysql/atomicupdate/bug_23415.pl | 18 ++++++++++++++++++ > installer/data/mysql/mandatory/sysprefs.sql | 5 +++-- > .../modules/admin/preferences/circulation.pref | 7 ++++++- > .../en/modules/admin/preferences/opac.pref | 8 +------- > .../prog/en/modules/circ/circulation.tt | 2 +- > .../prog/en/modules/members/moremember.tt | 2 +- > opac/opac-user.pl | 2 +- > t/db_dependent/Circulation.t | 12 ++++++------ > 10 files changed, 39 insertions(+), 21 deletions(-) > create mode 100755 installer/data/mysql/atomicupdate/bug_23415.pl > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 109809d4b99..42c45aa62d4 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -4601,7 +4601,7 @@ sub _CanBookBeAutoRenewed { > } > > if ( C4::Context->preference('OPACFineNoRenewalsBlockAutoRenew') ) { >- my $fine_no_renewals = C4::Context->preference("OPACFineNoRenewals"); >+ my $fine_no_renewals = C4::Context->preference("FineNoRenewals"); > my $amountoutstanding = > C4::Context->preference("OPACFineNoRenewalsIncludeCredit") > ? $patron->account->balance >diff --git a/circ/renew.pl b/circ/renew.pl >index 96c1781644b..5a101ba3a58 100755 >--- a/circ/renew.pl >+++ b/circ/renew.pl >@@ -67,7 +67,7 @@ if ($barcode) { > $patron = $checkout->patron; > > $balance = $patron->account->balance; >- my $amountlimit = C4::Context->preference("OPACFineNoRenewals"); >+ my $amountlimit = C4::Context->preference("FineNoRenewals"); > > if ( ( $patron->is_debarred || q{} ) lt dt_from_string()->ymd() ) { > my $can_renew; >diff --git a/installer/data/mysql/atomicupdate/bug_23415.pl b/installer/data/mysql/atomicupdate/bug_23415.pl >new file mode 100755 >index 00000000000..a4160f16cea >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_23415.pl >@@ -0,0 +1,18 @@ >+use Modern::Perl; >+ >+return { >+ bug_number => "23415", >+ description => "Rename OPACFineNoRenewals", >+ 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"; >+ } >+ ); >+ >+ say $out "Updated system preference 'OPACFineNoRenewals'"; >+ }, >+}; >diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql >index 669074aa506..e4625540b58 100644 >--- a/installer/data/mysql/mandatory/sysprefs.sql >+++ b/installer/data/mysql/mandatory/sysprefs.sql >@@ -271,6 +271,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('FinesIncludeGracePeriod','1',NULL,'If enabled, fines calculations will include the grace period.','YesNo'), > ('FinesLog','1',NULL,'If ON, log fines','YesNo'), > ('finesMode','off','off|production','Choose the fines mode, \'off\' (no charges), \'production\' (accrue overdue fines). Requires accruefines cronjob.','Choice'), >+('FineNoRenewals','100','','Fine limit above which user or staff cannot renew items','Integer'), > ('ForceLibrarySelection','0',NULL,'Force staff to select a library when logging into the staff interface.','YesNo'), > ('FRBRizeEditions','0','','If ON, Koha will query one or more ISBN web services for associated ISBNs and display an Editions tab on the details pages','YesNo'), > ('GenerateAuthorityField667', 'Machine generated authority record', NULL, 'When BiblioAddsAuthorities and AutoCreateAuthorities are enabled, use this as a default value for the 667$a field of MARC21 records', 'free'), >@@ -474,8 +475,8 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('OPACFallback', 'prog', 'bootstrap|prog', 'Define the fallback theme for the OPAC interface.', 'Themes'), > ('OpacFavicon','','','Enter a complete URL to an image to replace the default Koha favicon on the OPAC','free'), > ('OPACFineNoRenewals','100','','Fine limit above which user cannot renew books via OPAC','Integer'), >-('OPACFineNoRenewalsBlockAutoRenew','0','','Block/Allow auto renewals if the patron owe more than OPACFineNoRenewals','YesNo'), >-('OPACFineNoRenewalsIncludeCredits','1',NULL,'If enabled the value specified in OPACFineNoRenewals should include any unapplied account credits in the calculation','YesNo'), >+('OPACFineNoRenewalsBlockAutoRenew','0','','Block/Allow auto renewals if the patron owe more than FineNoRenewals','YesNo'), >+('OPACFineNoRenewalsIncludeCredits','1',NULL,'If enabled the value specified in FineNoRenewals should include any unapplied account credits in the calculation','YesNo'), > ('OPACFinesTab','1','','If OFF the patron fines tab in the OPAC is disabled.','YesNo'), > ('OPACFRBRizeEditions','0','','If ON, the OPAC will query one or more ISBN web services for associated ISBNs and display an Editions tab on the details pages','YesNo'), > ('OpacHiddenItems','','','This syspref allows to define custom rules for hiding specific items at the OPAC. See http://wiki.koha-community.org/wiki/OpacHiddenItems for more information.','Textarea'), >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 080e8fa4948..ffa23a3376f 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 >@@ -513,7 +513,7 @@ Circulation: > blockitem: block renewing only for this item. > block: block renewing for all the patron's items. > - >- - If a patron owes more than the value of <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OPACFineNoRenewals">OPACFineNoRenewals</a>, >+ - If a patron owes more than the value of <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=FineNoRenewals">FineNoRenewals</a>, > - pref: OPACFineNoRenewalsBlockAutoRenew > choices: > 1: block >@@ -571,6 +571,11 @@ Circulation: > - This is a list of value pairs. When an item is checked out, if the not for loan value on the left matches the items not for loan value > - "it will be updated to the right-hand value. For example, '-1: 0' will cause an item that was set to 'Ordered' to now be available for loan." > - Each pair of values should be on a separate line. >+ - >+ - Only allow patrons or staff to renew items if patron has less than >+ - pref: FineNoRenewals >+ class: currency >+ - [% local_currency %] in fines (leave blank to disable). > Checkin policy: > - > - pref: TrapHoldsOnOrder >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >index dbfa81749fc..00130d612b7 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >@@ -591,18 +591,12 @@ OPAC: > none: "NULL" > opacrenew: "'OPACRenew'" > - as branchcode to store in the statistics table. >- - >- - Only allow patrons to renew their own books on the OPAC if they have less than >- - pref: OPACFineNoRenewals >- class: currency >- - '[% local_currency %] in charges (leave blank to disable).' >- - <br /><strong>NOTE:</strong> If set, confirmation dialog is shown when renewing for patron with charges from staff interface.' > - > - pref: OPACFineNoRenewalsIncludeCredits > choices: > 1: Include > 0: "Don't include" >- - outstanding/unapplied credits when applying the <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OPACFineNoRenewals">OPACFineNoRenewals</a> rule to patrons. >+ - outstanding/unapplied credits when applying the <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=FineNoRenewals">FineNoRenewals</a> rule to patrons. > - > - pref: OpacHiddenItems > type: textarea >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >index f6e3c7c0b6d..184b37c038f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >@@ -1006,7 +1006,7 @@ > > [% UNLESS ( patron.borrowernumber ) %]window.onload=function(){ $('#findborrower').focus(); };[% END %] > >- var amountlimit = "[% Koha.Preference('OPACFineNoRenewals') | html %]"; >+ var amountlimit = "[% Koha.Preference('FineNoRenewals') | html %]"; > var fines = "[% fines | html %]"; > var MSG_CONFRIM_RENEW = _("The patron has a debt of %s.\n Are you sure you want to renew checkout(s)?").format(fines); > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >index 48b38da92c7..d113367d727 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >@@ -730,7 +730,7 @@ > table_settings_relatives_issues_table = [% TablesSettings.GetTableSettings( 'members', 'moremember', 'relatives-issues-table', 'json' ) | $raw %] > table_settings_holds_table = [% TablesSettings.GetTableSettings( 'members', 'moremember', 'holds-table', 'json' ) | $raw %] > >- var amountlimit = "[% Koha.Preference('OPACFineNoRenewals') | html %]"; >+ var amountlimit = "[% Koha.Preference('FineNoRenewals') | html %]"; > var fines = "[% fines | html %]"; > var MSG_CONFRIM_RENEW = _("The patron has a debt of %s.\n Are you sure you want to renew checkout(s)?").format(fines); > >diff --git a/opac/opac-user.pl b/opac/opac-user.pl >index 5c7296b201d..713957901ce 100755 >--- a/opac/opac-user.pl >+++ b/opac/opac-user.pl >@@ -127,7 +127,7 @@ if ( $userdebarred || $borr->{'gonenoaddress'} || $borr->{'lost'} ) { > } > > my $amountoutstanding = $patron->account->balance; >-my $no_renewal_amt = C4::Context->preference( 'OPACFineNoRenewals' ); >+my $no_renewal_amt = C4::Context->preference( 'FineNoRenewals' ); > $no_renewal_amt = undef unless looks_like_number( $no_renewal_amt ); > my $amountoutstandingfornewal = > C4::Context->preference("OPACFineNoRenewalsIncludeCredit") >diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t >index 5095afde735..3d4d80e585c 100755 >--- a/t/db_dependent/Circulation.t >+++ b/t/db_dependent/Circulation.t >@@ -1184,7 +1184,7 @@ subtest "CanBookBeRenewed tests" => sub { > } > ); > C4::Context->set_preference('OPACFineNoRenewalsBlockAutoRenew','1'); >- C4::Context->set_preference('OPACFineNoRenewals','10'); >+ C4::Context->set_preference('FineNoRenewals','10'); > C4::Context->set_preference('OPACFineNoRenewalsIncludeCredit','1'); > my $fines_amount = 5; > my $account = Koha::Account->new({patron_id => $renewing_borrowernumber}); >@@ -1200,7 +1200,7 @@ subtest "CanBookBeRenewed tests" => sub { > ( $renewokay, $error ) = > CanBookBeRenewed( $renewing_borrower_obj, $issue ); > is( $renewokay, 1, 'Renew, even if renewal is automatic' ); >- is( $error, 'auto_renew', 'Can auto renew, OPACFineNoRenewals=10, patron has 5' ); >+ is( $error, 'auto_renew', 'Can auto renew, FineNoRenewals=10, patron has 5' ); > > $account->add_debit( > { >@@ -1214,7 +1214,7 @@ subtest "CanBookBeRenewed tests" => sub { > ( $renewokay, $error ) = > CanBookBeRenewed( $renewing_borrower_obj, $issue ); > is( $renewokay, 1, 'Renew, even if renewal is automatic' ); >- is( $error, 'auto_renew', 'Can auto renew, OPACFineNoRenewals=10, patron has 10' ); >+ is( $error, 'auto_renew', 'Can auto renew, FineNoRenewals=10, patron has 10' ); > > $account->add_debit( > { >@@ -1228,7 +1228,7 @@ subtest "CanBookBeRenewed tests" => sub { > ( $renewokay, $error ) = > CanBookBeRenewed( $renewing_borrower_obj, $issue ); > is( $renewokay, 0, 'Do not renew, renewal is automatic' ); >- is( $error, 'auto_too_much_oweing', 'Cannot auto renew, OPACFineNoRenewals=10, patron has 15' ); >+ is( $error, 'auto_too_much_oweing', 'Cannot auto renew, FineNoRenewals=10, patron has 15' ); > > $account->add_credit( > { >@@ -1241,13 +1241,13 @@ subtest "CanBookBeRenewed tests" => sub { > ( $renewokay, $error ) = > CanBookBeRenewed( $renewing_borrower_obj, $issue ); > is( $renewokay, 1, 'Renew, even if renewal is automatic' ); >- is( $error, 'auto_renew', 'Can auto renew, OPACFineNoRenewals=10, OPACFineNoRenewalsIncludeCredit=1, patron has 15 debt, 5 credit' ); >+ is( $error, 'auto_renew', 'Can auto renew, FineNoRenewals=10, OPACFineNoRenewalsIncludeCredit=1, patron has 15 debt, 5 credit' ); > > C4::Context->set_preference('OPACFineNoRenewalsIncludeCredit','0'); > ( $renewokay, $error ) = > CanBookBeRenewed( $renewing_borrower_obj, $issue ); > is( $renewokay, 0, 'Do not renew, renewal is automatic' ); >- is( $error, 'auto_too_much_oweing', 'Cannot auto renew, OPACFineNoRenewals=10, OPACFineNoRenewalsIncludeCredit=1, patron has 15 debt, 5 credit' ); >+ is( $error, 'auto_too_much_oweing', 'Cannot auto renew, FineNoRenewals=10, OPACFineNoRenewalsIncludeCredit=1, patron has 15 debt, 5 credit' ); > > $dbh->do('DELETE FROM accountlines WHERE borrowernumber=?', undef, $renewing_borrowernumber); > C4::Context->set_preference('OPACFineNoRenewalsIncludeCredit','1'); >-- >2.43.0
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