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 <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Nick Clemens 2021-03-16 13:22:26 +00:00 committed by Jonathan Druart
parent 151966d096
commit deb2f6317a
4 changed files with 8 additions and 6 deletions

View File

@ -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");
}

View File

@ -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'),

View File

@ -970,7 +970,7 @@ Circulation:
production: Calculate and charge
- fines (when <code>cronjobs/fines.pl</code> is being run).
- '<br><strong>NOTE:</strong> 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 <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=CalculateFinesOnReturn">CalculateFinesOnReturn</a> is enabled, final fines will be calculated when an item is returned.<br/>'
- pref: ChargeFinesOnCloseDay
- pref: ChargeFinesOnClosedDays
type: choice
choices:
0: "Don't charge"

View File

@ -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
}