diff options
| author | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2023-03-06 10:40:41 +0000 |
|---|---|---|
| committer | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2023-03-06 10:40:41 +0000 |
| commit | 0822eb3d455e6b3c60f3f80a3db705e63c8aa50a (patch) | |
| tree | fc19159d8129e8e18e2fac141021f6b644723be0 /lib/models/ConsultationBlock.php | |
| parent | a423fd592d1fc30c947c5bbb36cc394a86e89f98 (diff) | |
show appropriate info message when a holiday interferes with the creation of blocks, fixes #2265
Closes #2265
Merge request studip/studip!1492
Diffstat (limited to 'lib/models/ConsultationBlock.php')
| -rw-r--r-- | lib/models/ConsultationBlock.php | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/models/ConsultationBlock.php b/lib/models/ConsultationBlock.php index e7140e3..f35e98b 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)); + } } /** |
