From 7a11a007aeca77100d474c66c0864c436311639f Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Tue, 16 Mar 2021 13:22:26 +0000 Subject: [PATCH] Bug 27835: (follow-up) Update language, remove warn, add feedback This patch: - Updates lanugage to be clearer 'ChargeFinesOnClosedDays' vs 'ChargeFinesOnCloseDay' - Removes a stary warn - Add an 'updated' counter and provides feedback in fines.pl Test plan: 0 - Apply patches, updatedatabase 1 - set finesCalendar to 'ignore', ChargeFinesOnClosedDays to "Don't charge" 2 - Checkout an item due yesterday 3 - Ensure circ rules have a fine amount and interval set 4 - Make today a holiday 5 - perl misc/cronjobs/fines.pl -v 6 - 0 updated 7 - ChargeFinesOnClosedDays to "Charge" 8 - perl misc/cronjobs/fines.pl -v 9 - 1 updated 10 - set fines calendar to 'use' 11 - perl misc/cronjobs/fines.pl -v 12 - 1 updated (NOTE: This is wrong maybe, but handle on another bug) 13 - set ChargeFinesOnClosedDays to "Don't charge" 14 - perl misc/cronjobs/fines.pl -v 12 - 0 updated Signed-off-by: Nick Clemens Signed-off-by: Tomas Cohen Arazi --- installer/data/mysql/atomicupdate/bug_27835.perl | 4 ++-- installer/data/mysql/mandatory/sysprefs.sql | 2 +- .../prog/en/modules/admin/preferences/circulation.pref | 2 +- misc/cronjobs/fines.pl | 6 ++++-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/installer/data/mysql/atomicupdate/bug_27835.perl b/installer/data/mysql/atomicupdate/bug_27835.perl index 5f718a9ca5e..71ceefed62a 100644 --- a/installer/data/mysql/atomicupdate/bug_27835.perl +++ b/installer/data/mysql/atomicupdate/bug_27835.perl @@ -3,8 +3,8 @@ if( CheckVersion( $DBversion ) ) { $dbh->do(q| INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) - VALUES ('ChargeFinesOnCloseDay', '1', NULL, 'Charge fines on close day.', 'YesNo') + VALUES ('ChargeFinesOnClosedDays', '1', NULL, 'Charge fines on days the library is closed.', 'YesNo') |); - NewVersion( $DBversion, 27835, "Add new system preference ChargeFinesOnCloseDay"); + NewVersion( $DBversion, 27835, "Add new system preference ChargeFinesOnClosedDays"); } diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql index 3e6df3cc291..a8998787205 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -122,7 +122,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('casServerUrl','https://localhost:8443/cas','','URL of the cas server','Free'), ('CatalogModuleRelink','0',NULL,'If OFF the linker will never replace the authids that are set in the cataloging module.','YesNo'), ('CataloguingLog','1',NULL,'If ON, log edit/create/delete actions on bibliographic data. WARNING: this feature is very resource consuming.','YesNo'), -('ChargeFinesOnCloseDay','1',NULL,'Charge fines on close day.','YesNo') +('ChargeFinesOnClosedDays','1',NULL,'Charge fines on days the library is closed.','YesNo') ('CheckPrevCheckout','hardno','hardyes|softyes|softno|hardno','By default, for every item checked out, should we warn if the patron has borrowed that item in the past?','Choice'), ('CheckPrevCheckoutDelay','0', NULL,'Maximum number of days that will trigger a warning if the patron has borrowed that item in the past when CheckPrevCheckout is enabled.','free'), ('CircAutoPrintQuickSlip','qslip',NULL,'Choose what should happen when an empty barcode field is submitted in circulation: Display a print quick slip window, Display a print slip window or Clear the screen.','Choice'), 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 b38798fc35e..9acc59f50e3 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 @@ -970,7 +970,7 @@ Circulation: production: Calculate and charge - fines (when cronjobs/fines.pl is being run). - '
NOTE: If the cronjobs/fines.pl cronjob is being run, accruing and final fines will be calculated when the cron runs and accruing fines will be finalized when an item is returned. If CalculateFinesOnReturn is enabled, final fines will be calculated when an item is returned.
' - - pref: ChargeFinesOnCloseDay + - pref: ChargeFinesOnClosedDays type: choice choices: 0: "Don't charge" diff --git a/misc/cronjobs/fines.pl b/misc/cronjobs/fines.pl index 554c30fc49d..afc6b4d5566 100755 --- a/misc/cronjobs/fines.pl +++ b/misc/cronjobs/fines.pl @@ -115,6 +115,7 @@ if ($filename) { print {$fh} "\n"; } my $counted = 0; +my $updated = 0; my $params; $params->{maximumdays} = $maxdays if $maxdays; my $overdues = Getoverdues($params); @@ -152,11 +153,10 @@ for my $overdue ( @{$overdues} ) { if ( $mode eq 'production' && ( !$is_holiday{$branchcode} - || C4::Context->preference('ChargeFinesOnCloseDay') ) + || C4::Context->preference('ChargeFinesOnClosedDays') ) && ( $amount && $amount > 0 ) ) { - warn 'charge'; UpdateFine( { issue_id => $overdue->{issue_id}, @@ -166,6 +166,7 @@ for my $overdue ( @{$overdues} ) { due => output_pref($datedue), } ); + $updated++; } my $borrower = $patron->unblessed; if ($filename) { @@ -194,6 +195,7 @@ EOM Number of Overdue Items: counted $overdue_items reported $counted + updated $updated EOM } -- 2.31.0