feat(leave) : source carried CP from prior non-forfait phase
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -564,6 +564,34 @@ final readonly class EmployeeLeaveSummaryProvider implements ProviderInterface
|
|||||||
return $prior;
|
return $prior;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CP nets encore disponibles (jours + samedis) hérités de la phase non-forfait
|
||||||
|
* précédant immédiatement une entrée en FORFAIT. 0 si aucune phase précédente
|
||||||
|
* ou si la précédente est elle-même un FORFAIT (nouvel embauché → cas 2).
|
||||||
|
*
|
||||||
|
* Le total disponible = remainingDays (acquis restant) + accruingDays (généré
|
||||||
|
* restant, samedis générés inclus) + remainingSaturdays (samedis acquis restant).
|
||||||
|
* Les congés déjà posés sous la phase précédente sont déjà déduits par
|
||||||
|
* computeYearSummary, donc on récupère bien le NET (ex. Grégory : 12 acquis − 5 pris ≈ 7).
|
||||||
|
*/
|
||||||
|
private function resolveCarriedCpFromPriorPhase(Employee $employee, ContractPhase $forfaitPhase): float
|
||||||
|
{
|
||||||
|
$prior = $this->resolvePhaseImmediatelyBefore($employee, $forfaitPhase);
|
||||||
|
if (null === $prior || ContractType::FORFAIT === $prior->contractType) {
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$reference = $prior->endDate ?? new DateTimeImmutable('today');
|
||||||
|
$priorYear = $this->exerciseYearResolver->forDate($reference, false);
|
||||||
|
|
||||||
|
$summary = $this->computeYearSummary($employee, $priorYear, 0.0, null, $prior);
|
||||||
|
if (null === $summary) {
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $summary['remainingDays'] + $summary['accruingDays'] + $summary['remainingSaturdays'];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param list<ContractSuspension> $suspensions
|
* @param list<ContractSuspension> $suspensions
|
||||||
* @param list<array{start: DateTimeImmutable, end: DateTimeImmutable}> $longMaladiePeriods
|
* @param list<array{start: DateTimeImmutable, end: DateTimeImmutable}> $longMaladiePeriods
|
||||||
|
|||||||
Reference in New Issue
Block a user