From c8a3e85d3c7a9516336cf920075f8b9a943c35d2 Mon Sep 17 00:00:00 2001 From: Chris Cormack Date: Tue, 30 Apr 2013 08:56:22 +1200 Subject: [PATCH] Bug 10120: Adding a syspref to control if overdue charges are updated on return On by default. To Test 1/ Create an overdue item, that should get fines 2/ Return the item 3/ Check the borrowers record to see if the fine has been added/updated Apply patch 1/ Make sure preference is set to do Repeat steps 1-3 above 2/ Switch the preference to don't Repeat stes 1-2 3/ Check the fine hasn't been added/updated Signed-off-by: David Cook Signed-off-by: Katrin Fischer All tests and QA script pass, works as described. I would categorize this a bug fix for libraries that don't want the new changed behaviour that was introduced by recalculating fines on return. Signed-off-by: Galen Charlton (cherry picked from commit fc61bd30186b0305579c5dee0a14f9d2733cd5db) Solved conflicts in: installer/data/mysql/sysprefs.sql installer/data/mysql/updatedatabase.pl and changed DB version number. Signed-off-by: Tomas Cohen Arazi (cherry picked from commit 1c6ab7f78575e7cc4eaee3eca397002ba9e23c8e) Solved conflicts in: installer/data/mysql/sysprefs.sql installer/data/mysql/updatedatabase.pl and changed DB version number. Signed-off-by: Bernardo Gonzalez Kriegel (cherry picked from commit 1c6ab7f78575e7cc4eaee3eca397002ba9e23c8e) --- C4/Circulation.pm | 4 +++- installer/data/mysql/sysprefs.sql | 7 +++++++ installer/data/mysql/updatedatabase.pl | 12 ++++++++++++ .../en/modules/admin/preferences/circulation.pref | 7 +++++++ 4 files changed, 29 insertions(+), 1 deletion(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 12f77307d8..6e81352ba4 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -1773,7 +1773,9 @@ sub AddReturn { } if ($borrowernumber) { - if($issue->{'overdue'}){ + if( C4::Context->preference('CalculateFinesOnReturn') && $issue->{'overdue'}){ + # we only need to calculate and change the fines if we want to do that on return + # Should be on for hourly loans my ( $amount, $type, $unitcounttotal ) = C4::Overdues::CalcFine( $item, $borrower->{categorycode},$branch, $datedue, $today ); $type ||= q{}; if ( $amount > 0 && ( C4::Context->preference('finesMode') eq 'production' )) { diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index af1d85fcf9..a874eb17ac 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -390,3 +390,10 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES(' INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('OPACNumbersPreferPhrase','0', NULL, 'Control the use of phr operator in callnumber and standard number OPAC searches', 'YesNo'); INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('IntranetNumbersPreferPhrase','0', NULL, 'Control the use of phr operator in callnumber and standard number staff client searches', 'YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('UNIMARCAuthorsFacetsSeparator',', ', 'UNIMARC authors facets separator', NULL, 'short'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('UseKohaPlugins','0','Enable or disable the ability to use Koha Plugins.','','YesNo'); +INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('TimeFormat','24hr','12hr|24hr','Defines the global time format for visual output.','Choice'); +INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES('DisplayIconsXSLT', '1', '', 'If ON, displays the format, audience, and material type icons in XSLT MARC21 results and detail pages.', 'YesNo'); +INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('HighlightOwnItemsOnOPAC','0','','If on, and a patron is logged into the OPAC, items from his or her home library will be emphasized and shown first in search results and item details.','YesNo'); +INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('HighlightOwnItemsOnOPACWhich','PatronBranch','PatronBranch|OpacURLBranch','Decides which branch''s items to emphasize. If PatronBranch, emphasize the logged in user''s library''s items. If OpacURLBranch, highlight the items of the Apache var BRANCHCODE defined in Koha''s Apache configuration file.','Choice'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('UniqueItemFields', 'barcode', 'Space-separated list of fields that should be unique (used in acquisition module for item creation). Fields must be valid SQL column names of items table', '', 'Free'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('CalculateFinesOnReturn','1','Switch to control if overdue fines are calculated on return or not', '', 'YesNo'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 96be1dc7c7..59c6f79e8b 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -6253,6 +6253,18 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { SetVersion ($DBversion); } +$DBversion = "3.10.06.001"; +if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { + $dbh->do( + q{ +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('CalculateFinesOnReturn','1','Switch to control if overdue fines are calculated on return or not', '', 'YesNo'); +} + ); + print +"Upgrade to $DBversion done (Bug 10120 - Fines on item return controlled by a systempreference)\n"; + SetVersion($DBversion); +} + =head1 FUNCTIONS 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 c583bbeaf3..945d3b8a57 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 @@ -301,6 +301,13 @@ Circulation: yes: Block no: "Don't block" - returning of items that have been withdrawn. + - + - pref: CalculateFinesOnReturn + choices: + yes: Do + no: "Don't" + - calculate and update overdue charges when an item is returned. + -
NOTE If you are doing hourly loans then you should have this on. Holds Policy: - - pref: AllowHoldPolicyOverride -- 2.39.5