Bugzilla – Attachment 102577 Details for
Bug 24380
Add option to recalculate fines upon a backdated return distinctly from `CalculateFinesOnReturn`
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24380: Add syspref CalculateFinesOnBackdate
Bug-24380-Add-syspref-CalculateFinesOnBackdate.patch (text/plain), 5.22 KB, created by
Kyle M Hall (khall)
on 2020-04-08 14:40:22 UTC
(
hide
)
Description:
Bug 24380: Add syspref CalculateFinesOnBackdate
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2020-04-08 14:40:22 UTC
Size:
5.22 KB
patch
obsolete
>From e21946bbfdcf6e3b3af5abf136c6889ee6ef9ee3 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Wed, 8 Apr 2020 10:39:28 -0400 >Subject: [PATCH] Bug 24380: Add syspref CalculateFinesOnBackdate > >--- > C4/Circulation.pm | 6 +++++- > installer/data/mysql/atomicupdate/bug_24380.perl | 9 +++++++++ > installer/data/mysql/sysprefs.sql | 1 + > .../prog/en/modules/admin/preferences/circulation.pref | 6 ++++++ > t/db_dependent/Circulation/Returns.t | 3 ++- > 5 files changed, 23 insertions(+), 2 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_24380.perl > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index bb419867d9..527b878858 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -1973,7 +1973,11 @@ sub AddReturn { > MarkIssueReturned( $borrowernumber, $item->itemnumber, $return_date, $patron->privacy ); > }; > unless ( $@ ) { >- if ( ( $return_date_specified || C4::Context->preference('CalculateFinesOnReturn') ) && !$item->itemlost ) { >+ my $calc_fine = C4::Context->preference('CalculateFinesOnReturn'); >+ $calc_fine ||= $return_date_specified && C4::Context->preference('CalculateFinesOnBackdate'); >+ $calc_fine &&= !$item->itemlost; >+ >+ if ( $calc_fine ) { > _CalculateAndUpdateFine( { issue => $issue, item => $item->unblessed, borrower => $patron_unblessed, return_date => $return_date } ); > } > } else { >diff --git a/installer/data/mysql/atomicupdate/bug_24380.perl b/installer/data/mysql/atomicupdate/bug_24380.perl >new file mode 100644 >index 0000000000..b5cb55f8a4 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_24380.perl >@@ -0,0 +1,9 @@ >+$DBversion = 'XXX'; # will be replaced by the RM >+if( CheckVersion( $DBversion ) ) { >+ $dbh->do(q{ >+ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES >+ ('CalculateFinesOnBackdate','1','','Switch to control if overdue fines are calculated on return when backdating','YesNo'); >+ }); >+ >+ NewVersion( $DBversion, 24380, "Add syspref CalculateFinesOnBackdate"); >+} >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index a15c4c6c95..a83e6bd479 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -108,6 +108,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('BranchTransferLimitsType','ccode','itemtype|ccode','When using branch transfer limits, choose whether to limit by itemtype or collection code.','Choice'), > ('BrowseResultSelection','0',NULL,'Enable/Disable browsing search results fromt the bibliographic record detail page in staff client','YesNo'), > ('CalculateFinesOnReturn','1','','Switch to control if overdue fines are calculated on return or not','YesNo'), >+('CalculateFinesOnBackdate','1','','Switch to control if overdue fines are calculated on return when backdating','YesNo'), > ('CalendarFirstDayOfWeek','0','0|1|2|3|4|5|6','Select the first day of week to use in the calendar.','Choice'), > ('CanMarkHoldsToPullAsLost','do_not_allow','do_not_allow|allow|allow_and_notify','Add a button to the "Holds to pull" screen to mark an item as lost and notify the patron.','Choice'), > ('canreservefromotherbranches','1','','With Independent branches on, can a user from one library place a hold on an item from another library','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 d9823c74a6..cca99d52d6 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 >@@ -546,6 +546,12 @@ Circulation: > - calculate and update overdue charges when an item is returned. > - "<br /><strong>NOTE: If you are doing hourly loans then you should have this on.</strong>" > - "<br /><strong>NOTE: This system preference requires FinesMode to be set to 'Calculate and charge.'</strong>" >+ - >+ - pref: CalculateFinesOnBackdate >+ choices: >+ yes: Do >+ no: "Don't" >+ - calculate and update overdue charges when an item is returned with a backdated return date. > - > - pref: UpdateItemLocationOnCheckin > type: textarea >diff --git a/t/db_dependent/Circulation/Returns.t b/t/db_dependent/Circulation/Returns.t >index 74ac815a98..eadaa9f6af 100644 >--- a/t/db_dependent/Circulation/Returns.t >+++ b/t/db_dependent/Circulation/Returns.t >@@ -402,7 +402,8 @@ subtest 'BranchTransferLimitsType' => sub { > subtest 'Backdated returns should reduce fine if needed' => sub { > plan tests => 1; > >- t::lib::Mocks::mock_preference( "CalculateFinesOnReturn", 0 ); >+ t::lib::Mocks::mock_preference( "CalculateFinesOnReturn", 0 ); >+ t::lib::Mocks::mock_preference( "CalculateFinesOnBackdate", 1 ); > > my $biblio = $builder->build_object( { class => 'Koha::Biblios' } ); > my $item = $builder->build_object( >-- >2.24.1 (Apple Git-126)
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 24380
:
97055
|
97544
|
97750
|
97751
|
97752
|
99536
|
99537
|
99538
|
102574
|
102575
|
102576
|
102577
|
102894
|
102895
|
102896
|
102981
|
102982
|
102983
|
102984
|
102985