fix : prise en compte des congés au provisionnel
All checks were successful
Auto Tag Develop / tag (push) Successful in 5s

This commit is contained in:
2026-03-11 17:26:48 +01:00
parent 3994be6556
commit 523d4f296b
2 changed files with 5 additions and 21 deletions

View File

@@ -168,7 +168,7 @@ final readonly class EmployeeLeaveSummaryProvider implements ProviderInterface
$carrySaturdays = 0.0;
}
$calculationEnd = $this->resolveCalculationEndDate($leavePolicy['ruleCode'], $year, $to, $employee);
$calculationEnd = $this->resolveCalculationEndDate($to, $employee);
$generatedDays = $leavePolicy['accrualPerMonth'] > 0.0
? $this->computeAccruedDaysFromStart(
$leavePolicy['acquiredDays'],
@@ -354,27 +354,10 @@ final readonly class EmployeeLeaveSummaryProvider implements ProviderInterface
}
private function resolveCalculationEndDate(
string $ruleCode,
int $year,
DateTimeImmutable $periodEnd,
Employee $employee
): ?DateTimeImmutable {
$today = new DateTimeImmutable('today');
$currentYear = LeaveRuleCode::FORFAIT_218->value === $ruleCode
? (int) $today->format('Y')
: $this->resolveCurrentLeaveYear($today);
if ($year < $currentYear) {
$end = $periodEnd;
} elseif ($year > $currentYear) {
$end = null;
} else {
$lastDayPreviousMonth = $today
->modify('first day of this month')
->modify('-1 day')
;
$end = $lastDayPreviousMonth < $periodEnd ? $lastDayPreviousMonth : $periodEnd;
}
$end = $periodEnd;
// Cap at contract end date if the employee has left.
$contractEndRaw = $employee->getCurrentContractEndDate();