From 6d4c397fd3a01b210990a5531cc160bff5bce384 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 13 Feb 2024 09:21:06 +0000 Subject: [PATCH] Bug 6796: Code defensively for if library hours are not set Sponsored-by: PTFS Europe Signed-off-by: Martin Renvoize --- C4/Circulation.pm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 23de0b1c890..49b49ac4971 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -3915,6 +3915,10 @@ sub CalcDateDue { my @close = undef; my $tomorrowhours = Koha::Library::Hours->find( { library_id => $branch, day => $tomorrow_dayofweek } ) ; # get open hours of next day + + # Defend against missing library hours definitions + if ( !$todayhours || !$tomorrowhours ) { $considerlibraryhours = 'ignore' } + my @open = undef; if ( $considerlibraryhours ne 'ignore' and $todayhours->close_time and $tomorrowhours->open_time ) { @close = split( ":", $todayhours->close_time ); -- 2.43.0