Commit 9b22140f authored by Stephane Bouvry's avatar Stephane Bouvry
Browse files

FIX : Si la répartition horaire sur une journée est fixée à 0, la journée...

FIX : Si la répartition horaire sur une journée est fixée à 0, la journée apparaît comme vérouillée (l'utilisateur ne peut pas y placer de créneau)
parent 13a0d6c1
Loading
Loading
Loading
Loading
+11 −0
Changes for module/Oscar/src/Oscar/Service/TimesheetService.php: 11 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -2234,6 +2234,7 @@ class TimesheetService implements UseOscarUserContextService, UseOscarConfigurat
            $dayOfWeek = $dayIndex + 1;

            $duration = array_key_exists($dayOfWeek, $daysDetails['days']) ? $daysDetails['days'][$dayOfWeek] : 0;
            $nullDayUser = array_key_exists($dayOfWeek, $daysDetails['days']) && $daysDetails['days'][$dayOfWeek] == 0;
            $maxlength = $duration * $amplitudeMax; //$daysDetails['max'];
            $minlength = $duration * $amplitudeMin; // $daysDetails['min'];

@@ -2255,6 +2256,8 @@ class TimesheetService implements UseOscarUserContextService, UseOscarConfigurat
            $closed = false;
            $closedReason = "";



            if ($dayIndex > 4 && $weekendAllowed == true) {
                $duration = 0.0;
                $maxlength = 0.0;
@@ -2277,9 +2280,17 @@ class TimesheetService implements UseOscarUserContextService, UseOscarConfigurat
                $duration = $daysDetails[$dayIndex + 1];
            }

            if( $locked == false && $nullDayUser == true ){
                $locked = true;
                $lockedReason = "Impossible de déclarer ce jour (répartition horaire)";
            }



//            $daysLabels[$dayKey] =  $daysFull[$dayIndex];
            $days[$dayKey] = [
                'duration' => 0.0,
                'nullDayUser' => $nullDayUser,
                'dayLength' => $duration,
                'maxLength' => $maxlength,
                'minLength' => $minlength,