Ajout des notification + page employé (#6)
Some checks failed
Auto Tag Develop / tag (push) Has been cancelled

| Numéro du ticket | Titre du ticket |
|------------------|-----------------|
|                  |                 |

## Description de la PR

## Modification du .env

## Check list

- [ ] Pas de régression
- [ ] TU/TI/TF rédigée
- [ ] TU/TI/TF OK
- [ ] CHANGELOG modifié

Reviewed-on: #6
Co-authored-by: tristan <tristan@yuno.malio.fr>
Co-committed-by: tristan <tristan@yuno.malio.fr>
This commit was merged in pull request #6.
This commit is contained in:
2026-03-10 12:35:17 +00:00
committed by Autin
parent ae42c70d50
commit f493ea237b
126 changed files with 9215 additions and 935 deletions

View File

@@ -6,6 +6,7 @@ namespace App\Repository;
use App\Entity\Employee;
use App\Entity\EmployeeContractPeriod;
use App\Repository\Contract\EmployeeContractPeriodReadRepositoryInterface;
use DateTimeImmutable;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
@@ -13,7 +14,7 @@ use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<EmployeeContractPeriod>
*/
final class EmployeeContractPeriodRepository extends ServiceEntityRepository
final class EmployeeContractPeriodRepository extends ServiceEntityRepository implements EmployeeContractPeriodReadRepositoryInterface
{
public function __construct(ManagerRegistry $registry)
{
@@ -72,4 +73,56 @@ final class EmployeeContractPeriodRepository extends ServiceEntityRepository
->execute()
;
}
public function hasPaidLeaveSettledClosureBetween(
Employee $employee,
DateTimeImmutable $from,
DateTimeImmutable $to
): bool {
$count = $this->createQueryBuilder('p')
->select('COUNT(p.id)')
->andWhere('p.employee = :employee')
->andWhere('p.paidLeaveSettled = :paidLeaveSettled')
->andWhere('p.endDate IS NOT NULL')
->andWhere('p.endDate >= :from')
->andWhere('p.endDate <= :to')
->setParameter('employee', $employee)
->setParameter('paidLeaveSettled', true)
->setParameter('from', $from)
->setParameter('to', $to)
->getQuery()
->getSingleScalarResult()
;
return (int) $count > 0;
}
public function findLatestPaidLeaveSettledClosureDateBetween(
Employee $employee,
DateTimeImmutable $from,
DateTimeImmutable $to
): ?DateTimeImmutable {
$result = $this->createQueryBuilder('p')
->select('p.endDate AS endDate')
->andWhere('p.employee = :employee')
->andWhere('p.paidLeaveSettled = :paidLeaveSettled')
->andWhere('p.endDate IS NOT NULL')
->andWhere('p.endDate >= :from')
->andWhere('p.endDate <= :to')
->setParameter('employee', $employee)
->setParameter('paidLeaveSettled', true)
->setParameter('from', $from)
->setParameter('to', $to)
->orderBy('p.endDate', 'DESC')
->setMaxResults(1)
->getQuery()
->getOneOrNullResult()
;
if (!is_array($result) || !isset($result['endDate']) || !$result['endDate'] instanceof DateTimeImmutable) {
return null;
}
return $result['endDate'];
}
}