From 0822eb3d455e6b3c60f3f80a3db705e63c8aa50a Mon Sep 17 00:00:00 2001 From: Jan-Hendrik Willms <tleilax+studip@gmail.com> Date: Mon, 6 Mar 2023 10:40:41 +0000 Subject: [PATCH] show appropriate info message when a holiday interferes with the creation of blocks, fixes #2265 Closes #2265 Merge request studip/studip!1492 --- lib/models/ConsultationBlock.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/models/ConsultationBlock.php b/lib/models/ConsultationBlock.php index e7140e303b0..f35e98b8359 100644 --- a/lib/models/ConsultationBlock.php +++ b/lib/models/ConsultationBlock.php @@ -170,6 +170,8 @@ class ConsultationBlock extends SimpleORMap implements PrivacyObject $current = strtotime('+1 day', $current); } + $warnings = []; + while ($current <= $end) { $temp = holiday($current); $holiday = is_array($temp) && $temp['col'] === 3; @@ -201,10 +203,21 @@ class ConsultationBlock extends SimpleORMap implements PrivacyObject $details ); } + } elseif (!$fail_silent) { + $warnings[] = sprintf( + _('Am %1$s können keine Termine erzeugt werden, da es ein Feiertag (%2$s) ist.'), + strftime('%x', $current), + $temp['name'] + ); } $current = strtotime("+{$interval} weeks", $current); } + + $warnings = array_unique($warnings); + foreach ($warnings as $warning) { + PageLayout::postInfo(htmlReady($warning)); + } } /** -- GitLab