@@ -, +, @@ --- C4/Overdues.pm | 6 +++++- installer/data/mysql/sysprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 8 ++++++++ .../en/modules/admin/preferences/circulation.pref | 6 ++++++ 4 files changed, 20 insertions(+), 1 deletions(-) --- a/C4/Overdues.pm +++ a/C4/Overdues.pm @@ -264,7 +264,11 @@ sub CalcFine { my $units_minus_grace = $chargeable_units - $data->{firstremind}; my $amount = 0; if ($data->{'chargeperiod'} && $units_minus_grace ) { - $amount = int($chargeable_units / $data->{'chargeperiod'}) * $data->{'fine'};# TODO fine calc should be in cents + if ( C4::Context->preference('FinesIncludeGracePeriod') ) { + $amount = int($chargeable_units / $data->{'chargeperiod'}) * $data->{'fine'};# TODO fine calc should be in cents + } else { + $amount = int($units_minus_grace / $data->{'chargeperiod'}) * $data->{'fine'}; + } } else { # a zero (or null) chargeperiod means no charge. } --- a/installer/data/mysql/sysprefs.sql +++ a/installer/data/mysql/sysprefs.sql @@ -374,3 +374,4 @@ INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ( INSERT INTO systempreferences (variable,value,explanation,type) VALUES('EnableBorrowerFiles','0','If enabled, allows librarians to upload and attach arbitrary files to a borrower record.','YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('UpdateTotalIssuesOnCirc','0','Whether to update the totalissues field in the biblio on each circ.',NULL,'YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('IntranetSlipPrinterJS','','Use this JavaScript for printing slips. Define at least function printThenClose(). For use e.g. with Firefox PlugIn jsPrintSetup, see http://jsprintsetup.mozdev.org/','','Free'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('FinesIncludeGracePeriod','1','If enabled, fines calculations will include the grace period.',NULL,'YesNo'); --- a/installer/data/mysql/updatedatabase.pl +++ a/installer/data/mysql/updatedatabase.pl @@ -5635,6 +5635,14 @@ if(C4::Context->preference("Version") < TransformToNum($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.09.00.XXX"; +if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { + $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('FinesIncludeGracePeriod','1','If enabled, fines calculations will include the grace period.',NULL,'YesNo');"); + + print "Upgrade to $DBversion done (Add system preference FinesIncludeGracePeriod)\n"; + SetVersion($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref @@ -394,6 +394,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: FinesForGracePeriod + choices: + yes: Include + no: "Don't include" + - the grace period when calculating the fine for an overdue item. Self Checkout: - - pref: ShowPatronImageInWebBasedSelfCheck --