feat : modification de la gestion des jours fériés
All checks were successful
Auto Tag Develop / tag (push) Successful in 6s

This commit is contained in:
2026-04-16 15:52:19 +02:00
parent 13c71abddc
commit a8fe244b5c
42 changed files with 1752 additions and 167 deletions

View File

@@ -14,6 +14,7 @@ use App\Repository\Contract\EmployeeScopedRepositoryInterface;
use App\Repository\Contract\FormationReadRepositoryInterface;
use App\Service\Contracts\EmployeeContractResolver;
use App\Service\WorkHours\AbsenceSegmentsResolver;
use App\Service\WorkHours\HolidayVirtualHoursResolver;
use App\Service\WorkHours\WorkedHoursCreditPolicy;
use DateTimeImmutable;
use Symfony\Bundle\SecurityBundle\Security;
@@ -32,6 +33,7 @@ final readonly class WorkHourDayContextProvider implements ProviderInterface
private EmployeeContractResolver $contractResolver,
private AbsenceSegmentsResolver $absenceSegmentsResolver,
private WorkedHoursCreditPolicy $workedHoursCreditPolicy,
private HolidayVirtualHoursResolver $holidayVirtualHoursResolver,
) {}
public function provide(Operation $operation, array $uriVariables = [], array $context = []): WorkHourDayContext
@@ -56,10 +58,12 @@ final readonly class WorkHourDayContextProvider implements ProviderInterface
// On initialise toutes les lignes, même sans absence ce jour-là.
$contract = $this->contractResolver->resolveForEmployeeAndDate($employee, $workDate);
$workDaysMinutes = $this->contractResolver->resolveWorkDaysMinutesForEmployeeAndDate($employee, $workDate);
$rowsByEmployeeId[$employeeId] = new DayContextRow(
employeeId: $employeeId,
hasContractAtDate: null !== $contract,
isDriverContract: $this->contractResolver->resolveIsDriverForEmployeeAndDate($employee, $workDate),
virtualHolidayMinutes: $this->holidayVirtualHoursResolver->resolveVirtualCredit($contract, $workDate, false, $workDaysMinutes),
);
}
@@ -98,6 +102,14 @@ final readonly class WorkHourDayContextProvider implements ProviderInterface
$rowsByEmployeeId[$employeeId]->setFormation('Formation');
}
// If an absence is declared on the day, the absence dictates the hours credited
// (via WorkedHoursCreditPolicy). The holiday virtual credit must not stack on top.
foreach ($rowsByEmployeeId as $row) {
if ($row->absentMorning || $row->absentAfternoon) {
$row->virtualHolidayMinutes = 0;
}
}
$response = new WorkHourDayContext();
$response->workDate = $dateKey;
$response->rows = array_map(