Skip to content
Snippets Groups Projects
Commit 0822eb3d authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms
Browse files

show appropriate info message when a holiday interferes with the creation of blocks, fixes #2265

Closes #2265

Merge request studip/studip!1492
parent a423fd59
No related branches found
No related tags found
1 merge request!4Draft: Icon creation
...@@ -170,6 +170,8 @@ class ConsultationBlock extends SimpleORMap implements PrivacyObject ...@@ -170,6 +170,8 @@ class ConsultationBlock extends SimpleORMap implements PrivacyObject
$current = strtotime('+1 day', $current); $current = strtotime('+1 day', $current);
} }
$warnings = [];
while ($current <= $end) { while ($current <= $end) {
$temp = holiday($current); $temp = holiday($current);
$holiday = is_array($temp) && $temp['col'] === 3; $holiday = is_array($temp) && $temp['col'] === 3;
...@@ -201,10 +203,21 @@ class ConsultationBlock extends SimpleORMap implements PrivacyObject ...@@ -201,10 +203,21 @@ class ConsultationBlock extends SimpleORMap implements PrivacyObject
$details $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); $current = strtotime("+{$interval} weeks", $current);
} }
$warnings = array_unique($warnings);
foreach ($warnings as $warning) {
PageLayout::postInfo(htmlReady($warning));
}
} }
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment