From 05d35140cf2adfe762c0b65e839f2afe29d385d0 Mon Sep 17 00:00:00 2001 From: Hammat Wele Date: Tue, 19 Aug 2025 20:11:58 +0000 Subject: [PATCH] Bug 17015: (follow-up) Use open_hours_between to consider library opening hours --- C4/Overdues.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/C4/Overdues.pm b/C4/Overdues.pm index 918ac0f52ba..2787b269943 100644 --- a/C4/Overdues.pm +++ b/C4/Overdues.pm @@ -352,14 +352,14 @@ sub get_chargeable_units { if ( $unit eq 'hours' ) { if ( C4::Context->preference('finesCalendar') eq 'noFinesWhenClosed' ) { my $calendar = Koha::DiscreteCalendar->new({ branchcode => $branchcode }); - $charge_duration = $calendar->hours_between( $date_due, $date_returned ); + $charge_duration = $calendar->open_hours_between( $date_due, $date_returned ); } else { $charge_duration = $date_returned->delta_ms($date_due); } - if ( $charge_duration->in_units('hours') == 0 && $charge_duration->in_units('seconds') > 0 ) { + if ( $charge_duration == 0 && $charge_duration->in_units('seconds') * 3600 > 0 ){ return 1; } - return $charge_duration->in_units('hours'); + return $charge_duration; } else { # days if ( C4::Context->preference('finesCalendar') eq 'noFinesWhenClosed' ) { my $calendar = Koha::DiscreteCalendar->new({ branchcode => $branchcode }); -- 2.34.1