From ca11d0ba2998996bbef39a9a9e2483bba21572d6 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Tue, 24 Apr 2012 09:05:36 -0400 Subject: [PATCH] Bug 7189 - preference to control if returning lost items gives refund Right now when you return an item that was lost the patron's card is credited with the lost fee, but not all libraries refund lost fees and sometimes the fee is refunded after the patron has paid for it, causing all kinds of financial issues. Adds the syspref RefundLostItemFeeOnReturn to control whether returning a lost item refunds the fee charged for losing that item. Enabled by default to maintain Koha's current functionality. Signed-off-by: Owen Leonard Passed-QA-by: Paul Poulain Signed-off-by: Jared Camins-Esakov --- C4/Circulation.pm | 12 +++++++++--- circ/returns.pl | 3 +++ installer/data/mysql/sysprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 7 +++++++ .../en/modules/admin/preferences/circulation.pref | 6 ++++++ .../intranet-tmpl/prog/en/modules/circ/returns.tt | 5 +++++ 6 files changed, 31 insertions(+), 3 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index ad86d4193d..afe7a6a39e 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -1252,7 +1252,9 @@ sub AddIssue { ## If item was lost, it has now been found, reverse any list item charges if neccessary. if ( $item->{'itemlost'} ) { - _FixAccountForLostAndReturned( $item->{'itemnumber'}, undef, $item->{'barcode'} ); + if ( C4::Context->preference('RefundLostItemFeeOnReturn' ) ) { + _FixAccountForLostAndReturned( $item->{'itemnumber'}, undef, $item->{'barcode'} ); + } } ModItem({ issues => $item->{'issues'}, @@ -1813,9 +1815,13 @@ sub AddReturn { } # fix up the accounts..... - if ($item->{'itemlost'}) { - _FixAccountForLostAndReturned($item->{'itemnumber'}, $borrowernumber, $barcode); # can tolerate undef $borrowernumber + if ( $item->{'itemlost'} ) { $messages->{'WasLost'} = 1; + + if ( C4::Context->preference('RefundLostItemFeeOnReturn' ) ) { + _FixAccountForLostAndReturned($item->{'itemnumber'}, $borrowernumber, $barcode); # can tolerate undef $borrowernumber + $messages->{'LostItemFeeRefunded'} = 1; + } } # fix up the overdues in accounts... diff --git a/circ/returns.pl b/circ/returns.pl index 902456d8cc..94727977b6 100755 --- a/circ/returns.pl +++ b/circ/returns.pl @@ -418,6 +418,9 @@ foreach my $code ( keys %$messages ) { elsif ( $code eq 'WasLost' ) { $err{waslost} = 1; } + elsif ( $code eq 'LostItemFeeRefunded' ) { + $template->param( LostItemFeeRefunded => 1 ); + } elsif ( $code eq 'ResFound' ) { ; # FIXME... anything to do here? } diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 44f9eb30dc..0cc5a54ec0 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -387,3 +387,4 @@ INSERT INTO systempreferences (variable,value,explanation,type) VALUES('INTRAdid INSERT INTO systempreferences (variable, value, options, explanation, type) VALUES ('BlockReturnOfWithdrawnItems', '1', '0', 'If enabled, items that are marked as withdrawn cannot be returned.', 'YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('HoldsToPullStartDate','2','Set the default start date for the Holds to pull list to this many days ago',NULL,'Integer'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('alphabet','A B C D E F G H I J K L M N O P Q R S T U V W X Y Z','Alphabet than can be expanded into browse links, e.g. on Home > Patrons',NULL,'free'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('RefundLostItemFeeOnReturn', '1', 'If enabled, the lost item fee charged to a borrower will be refunded when the lost item is returned.', NULL, 'YesNo'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 61bdd545ae..e7790ea0ea 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -6097,6 +6097,13 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { SetVersion ($DBversion); } +$DBversion = "3.11.00.XXX"; +if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { + $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('RefundLostItemFeeOnReturn', '1', 'If enabled, the lost item fee charged to a borrower will be refunded when the lost item is returned.', NULL, 'YesNo')"); + print "Upgrade to $DBversion done (Bug 7189: Add system preference RefundLostItemFeeOnReturn)\n"; + SetVersion($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) 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..c188d80edb 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 @@ -452,6 +452,12 @@ Circulation: test: Calculate (but only for mailing to the admin) production: Calculate and charge - fines (when misc/cronjobs/fines.pl is being run). + - + - pref: RefundLostItemFeeOnReturn + choices: + yes: Refund + no: "Don't refund" + - lost item fees charged to a borrower when the lost item is returned. Self Checkout: - - pref: ShowPatronImageInWebBasedSelfCheck diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt index a27b45f7a6..7fd8d1d55d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt @@ -332,6 +332,11 @@ $(document).ready(function () { [% END %] [% IF ( errmsgloo.waslost ) %]

Item was lost, now found.

+ [% IF ( LostItemFeeRefunded ) %] +

A refund has been applied to the borrowing patron's account.

+ [% ELSE %] +

Any lost item fees for this item will remain on the patron's account

+ [% END %] [% END %] [% IF ( errmsgloo.withdrawn ) %] [% IF BlockReturnOfWithdrawnItems %] -- 2.20.1