Pull the "date -> leave/RTT exercise year" formula out of
EmployeeRttPaymentProcessor, EmployeeRttSummaryProvider and
EmployeeLeaveSummaryProvider into a single
App\Service\Exercise\ExerciseYearResolver. Forfait flag is parameterised
so the leave (calendar year) and RTT (Juin N-1 -> Mai N) variants share
the same implementation. Pure refactor, no behavioural change.
Mirror Task 3 (leave provider) on the RTT side: accept an optional `?phaseId`
query parameter and cap the exercise window to the phase boundaries when set.
- Inject EmployeeContractPhaseResolver.
- New helpers: resolveTargetPhase, clampYearToPhase, exerciseYearForDate.
- resolveYear now takes the phase: default year falls back to the phase end
date when phaseId is provided; explicit year is silently clamped to the
phase range.
- provide() narrows periodFrom / periodTo / limitDate to the phase end date
for past phases.
- Default behavior (no phaseId) unchanged.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Extract private helper `exerciseYearForDate(date, isForfait)` to dedupe
the date->leave-exercise-year expression duplicated across `clampYearToPhase`
and `resolveFirstComputationYear` (4 copies collapsed into 1 helper + 4
call sites).
- Remove the unused `ContractPhase $phase` parameter from
`resolveLeavePeriodBounds`: the body never reads it (the phase cap is
applied later by `resolvePeriodBounds`).
- Add `ContractNature $contractNature` to `ContractPhase` DTO, populated
from the first period of the group by `EmployeeContractPhaseResolver`.
Drop the `resolveNatureForPhase` lookup in `EmployeeLeaveSummaryProvider`
in favor of `$phase->contractNature`. Expose `contractNature` in
`Employee::getContractPhases()` array shape for frontend use.
- Fix regression for terminated employees calling `computeYearSummary`
without an explicit phase (LeaveRecapRowBuilder,
DumpVerificationSnapshotCommand). Before the refactor the period bounds,
accrual end and taken end were NOT capped at the contract end for
terminated employees, because `Employee::getCurrentContractEndDate()`
returns null when no period covers "today". The new fallback phase
(`isCurrent=false`, real `endDate`) was silently capping `to`. Add an
internal `applyPhaseEndCap` flag, true when phase is explicit, false
for legacy callers, threaded through `resolvePeriodBounds`,
`resolveAccrualCalculationEndDate` and `resolveTakenCalculationEndDate`.
- Add regression test
`testTerminatedEmployeeWithoutExplicitPhaseSkipsPhaseEndCap` proving
that legacy callers keep the natural exercise upper bound while explicit
phase callers get the cap.
- Add `contractNature` assertion in `EmployeeContractPhaseResolverTest`.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The provider now resolves a target ContractPhase from a ?phaseId query
parameter and propagates it through resolveYear, resolvePeriodBounds,
resolveLeavePolicy, resolveAccrualCalculationEndDate,
resolveTakenCalculationEndDate, and resolveFirstComputationYear.
- phaseId missing → current phase (legacy behavior preserved)
- phaseId valid → past/current phase used for rule code, weekly hours
and period bounds (capped at phase end)
- phaseId invalid (non-numeric or unknown) → 422
- year missing + phaseId → year derived from phase end date
- year out of phase range + phaseId → silent clamp to phase boundaries
Public methods computeYearSummary/resolvePaidLeaveDays/resolveLeaveYearForToday
remain backward-compatible for external callers (LeaveRecapRowBuilder,
DumpVerificationSnapshotCommand).
Quand un employé n'a pas d'absence sur un jour férié, la cellule prend le fond bleu clair (#b3e5fc) et affiche le nom du férié au survol — cohérent avec la vue jour.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
| Numéro du ticket | Titre du ticket |
|------------------|-----------------|
| #339 | Ajout d'une page listant les règles de calcules |
## Description de la PR
[#339] Ajout d'une page listant les règles de calcules
## Modification du .env
## Check list
- [ ] Pas de régression
- [x] TU/TI/TF rédigée
- [x] TU/TI/TF OK
- [ ] CHANGELOG modifié
Reviewed-on: #5
Co-authored-by: tristan <tristan@yuno.malio.fr>
Co-committed-by: tristan <tristan@yuno.malio.fr>