This commit is contained in:
2026-09-12 10:45:31 +02:00
parent 245d09e62c
commit bcd85f131b
4 changed files with 135 additions and 20 deletions
+7 -3
View File
@@ -658,6 +658,10 @@ try {
$workdayEndStr = $workdaySettings['workday_end'] ?? '17:00';
$lunchStartStr = $workdaySettings['lunch_start'] ?? '12:30';
$lunchEndStr = $workdaySettings['lunch_end'] ?? '13:00';
$activeWorkdays = $workdaySettings['workdays'] ?? [1, 2, 3, 4, 5];
if (!is_array($activeWorkdays) || empty($activeWorkdays)) {
$activeWorkdays = [1, 2, 3, 4, 5];
}
$toMins = function(string $timeStr): int {
$parts = explode(':', trim($timeStr));
@@ -696,7 +700,7 @@ try {
$checkDate = clone $now;
if ($startFromNextWorkday) {
$checkDate->modify('+1 day');
while ((int)$checkDate->format('N') >= 6) {
while (!in_array((int)$checkDate->format('N'), $activeWorkdays, true)) {
$checkDate->modify('+1 day');
}
}
@@ -746,8 +750,8 @@ try {
while ($checkedDays < $maxDays) {
$dayOfWeek = (int)$checkDate->format('N'); // 1 = Ma, 7 = Zo
// Weekend overslaan
if ($dayOfWeek === 6 || $dayOfWeek === 7) {
// Niet-werkdag / weekend overslaan op basis van organisatie-instellingen
if (!in_array($dayOfWeek, $activeWorkdays, true)) {
$checkDate->modify('+1 day');
continue;
}