From 77ccdb35d01c0ed1014773265098bd9de3a6a8c0 Mon Sep 17 00:00:00 2001 From: campbell-m <87438215+campbell-m@users.noreply.github.com> Date: Sun, 23 Jun 2024 14:33:46 +0100 Subject: [PATCH] Fix bug in last commit --- web/mrbs_sql.inc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/web/mrbs_sql.inc b/web/mrbs_sql.inc index 6aedcfdc4f..b3a3f83a14 100644 --- a/web/mrbs_sql.inc +++ b/web/mrbs_sql.inc @@ -566,8 +566,11 @@ function mrbsCheckPolicy(array $booking, ?int $ignore_entry_id=null, ?int $ignor if (!empty($invalid_types_days[$booking['type']])) { $overlap_date = $entryInterval->overlapsDays($invalid_types_days[$booking['type']]); - $overlap_day = datetime_format(['pattern' => 'cccc'], $overlap_date->getTimestamp()); - $violations[] = get_vocab('type_not_allowed_day', get_type_vocab($booking['type']), $overlap_day); + if ($overlap_date !== false) + { + $overlap_day = datetime_format(['pattern' => 'cccc'], $overlap_date->getTimestamp()); + $violations[] = get_vocab('type_not_allowed_day', get_type_vocab($booking['type']), $overlap_day); + } } }