fix : correction des Heures et ajout d'une validation pour les chefs de site
Some checks failed
Auto Tag Develop / tag (push) Has been cancelled

This commit is contained in:
2026-02-26 14:49:28 +01:00
parent 5cced46254
commit b68fef61c4
20 changed files with 547 additions and 106 deletions

View File

@@ -8,7 +8,6 @@ use App\Entity\Contract;
use App\Entity\Employee;
use App\Repository\EmployeeContractPeriodRepository;
use DateTimeImmutable;
use LogicException;
readonly class EmployeeContractResolver
{
@@ -18,17 +17,9 @@ readonly class EmployeeContractResolver
public function resolveForEmployeeAndDate(Employee $employee, DateTimeImmutable $date): ?Contract
{
$period = $this->periodRepository->findOneCoveringDate($employee, $date);
$contract = $period?->getContract();
if (null === $contract) {
throw new LogicException(sprintf(
'Missing contract period for employee %d on %s.',
$employee->getId() ?? 0,
$date->format('Y-m-d')
));
}
$period = $this->periodRepository->findOneCoveringDate($employee, $date);
return $contract;
return $period?->getContract();
}
/**
@@ -75,23 +66,6 @@ readonly class EmployeeContractResolver
}
}
foreach ($employees as $employee) {
$employeeId = $employee->getId();
if (!$employeeId) {
continue;
}
foreach ($days as $day) {
if (null === ($resolved[$employeeId][$day] ?? null)) {
throw new LogicException(sprintf(
'Missing contract period for employee %d on %s.',
$employeeId,
$day
));
}
}
}
return $resolved;
}
}