Bug 10120: Adding a syspref to control if overdue charges are updated on return
authorChris Cormack <chris@bigballofwax.co.nz>
Mon, 29 Apr 2013 20:56:22 +0000 (08:56 +1200)
committerGalen Charlton <gmc@esilibrary.com>
Fri, 24 May 2013 15:47:12 +0000 (08:47 -0700)
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 <dcook@prosentient.com.au>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
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 <gmc@esilibrary.com>
C4/Circulation.pm
installer/data/mysql/sysprefs.sql
installer/data/mysql/updatedatabase.pl
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref

index 78cbeab..93bf8e1 100644 (file)
@@ -1785,7 +1785,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' )) {
index 9aabdb1..31485bc 100644 (file)
@@ -426,3 +426,4 @@ INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES (
 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 IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('UseCourseReserves', '0', 'Enable the course reserves feature.', NULL, 'YesNo');
 INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacShowHoldNotes',0,'Show hold notes on OPAC','','YesNo');
+INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('CalculateFinesOnReturn','1','Switch to control if overdue fines are calculated on return or not', '', 'YesNo');
index 3134261..e227796 100755 (executable)
@@ -6971,6 +6971,19 @@ if(CheckVersion($DBversion)) {
     SetVersion ($DBversion);
 }
 
+$DBversion = "XXX";
+if ( CheckVersion($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
 
 =head2 TableExists($table)
index 243b8e4..64cf338 100644 (file)
@@ -319,6 +319,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.
+            - <br /><b>NOTE If you are doing hourly loans then you should have this on.</b>
     Holds Policy:
         -
             - pref: AllowHoldPolicyOverride