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
Some checks failed
Auto Tag Develop / tag (push) Has been cancelled
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user