diff --git a/Koha/Charges/Fees.pm b/Koha/Charges/Fees.pm index a3d2a12e39..7eff76ba79 100644 --- a/Koha/Charges/Fees.pm +++ b/Koha/Charges/Fees.pm @@ -112,7 +112,7 @@ sub accumulate_rentalcharge { my $calendar = Koha::Calendar->new( branchcode => $self->library->id ); if ( $units eq 'hours' ) { - if ( $itemtype->rentalcharge_hourly_calendar && C4::Context->preference('finesCalendar') eq 'noFinesWhenClosed' ) { + if ( $itemtype->rentalcharge_hourly_calendar ) { $duration = $calendar->hours_between( $self->from_date->truncate( to => 'minute' ), $self->to_date->truncate( to => 'minute' ) @@ -124,7 +124,7 @@ sub accumulate_rentalcharge { } } else { - if ( $itemtype->rentalcharge_daily_calendar && C4::Context->preference('finesCalendar') eq 'noFinesWhenClosed' ) { + if ( $itemtype->rentalcharge_daily_calendar ) { $duration = $calendar->days_between( $self->from_date, $self->to_date ); } diff --git a/installer/data/mysql/atomicupdate/bug_21443.perl b/installer/data/mysql/atomicupdate/bug_21443.perl index 74cf57f650..82329231c0 100644 --- a/installer/data/mysql/atomicupdate/bug_21443.perl +++ b/installer/data/mysql/atomicupdate/bug_21443.perl @@ -16,6 +16,10 @@ if( CheckVersion( $DBversion ) ) { }); } + my $finesCalendar = C4::Context->preference('finesCalendar'); + my $value = $finesCalendar eq 'noFinesWhenClosed' ? 1 : 0; + $dbh->do("UPDATE itemtypes SET rentalcharge_hourly_calendar = $value, rentalcharge_daily_calendar = $value"); + # Always end with this (adjust the bug info) SetVersion( $DBversion ); print "Upgrade to $DBversion done (Bug 21443: Add ability to exclude holidays when calculating rentals fees by time period)\n"; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt index 3ba8410352..a0240539fa 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt @@ -248,7 +248,7 @@ Item types administration [% ELSE %] [% END %] - If checked, daily charge will be calculated based on the value of the system preference finesCalendar. If not checked, the fee will be calculated based on the number of days until due, directly. + If checked, daily charge will be calculated using the calendar to exclude holidays. If not checked, the fee will be calculated based on the number of days until due, directly.