[#SIRH-32] Ajouter l'exercice 2026/2027 dans les congés/RTT (#20)
Auto Tag Develop / tag (push) Successful in 9s
Auto Tag Develop / tag (push) Successful in 9s
| Numéro du ticket | Titre du ticket | |------------------|-----------------| | | | ## Description de la PR ## Modification du .env ## Check list - [x] Pas de régression - [x] TU/TI/TF rédigée - [x] TU/TI/TF OK - [ ] CHANGELOG modifié Reviewed-on: #20 Co-authored-by: tristan <tristan@yuno.malio.fr> Co-committed-by: tristan <tristan@yuno.malio.fr>
This commit was merged in pull request #20.
This commit is contained in:
@@ -188,24 +188,35 @@ final class LeaveRolloverCommand extends Command
|
||||
private function resolveCarry(Employee $employee, LeaveRuleCode $ruleCode, int $targetYear): array
|
||||
{
|
||||
$previousYear = $targetYear - 1;
|
||||
$previous = $this->leaveBalanceRepository->findOneByEmployeeRuleAndYear($employee, $ruleCode, $previousYear);
|
||||
if (null !== $previous) {
|
||||
$carryDays = $previous->getClosingDays() + $previous->getFractionedDays();
|
||||
$carrySaturdays = LeaveRuleCode::CDI_CDD_NON_FORFAIT === $ruleCode
|
||||
? $previous->getClosingSaturdays()
|
||||
: 0.0;
|
||||
} else {
|
||||
[$carryDays, $carrySaturdays] = $this->leaveBalanceComputationService
|
||||
->computeDynamicClosingForYear($employee, $ruleCode, $previousYear)
|
||||
;
|
||||
}
|
||||
|
||||
[$from, $to] = $this->leaveBalanceComputationService->resolvePeriodBounds($ruleCode, $previousYear);
|
||||
$hasSettlement = $this->leaveBalanceComputationService
|
||||
->hasPaidLeaveSettledClosureBetween($employee, $from, $to)
|
||||
;
|
||||
|
||||
if ($hasSettlement) {
|
||||
return [0.0, 0.0];
|
||||
$carryDays = 0.0;
|
||||
$carrySaturdays = 0.0;
|
||||
} else {
|
||||
// Compute the REAL closing of the ending exercise. computeDynamicClosingForYear
|
||||
// is bootstrap-aware (it anchors on the persisted opening balance of each year)
|
||||
// and already folds in accrual, taken absences and fractioned days. We must NOT
|
||||
// trust the stored closing_days: it is only ever written equal to the opening at
|
||||
// row creation (placeholder), so trusting it would propagate the opening and
|
||||
// ignore the year's accrual (cas Aurore : report 0 au lieu de 31).
|
||||
[$carryDays, $carrySaturdays] = $this->leaveBalanceComputationService
|
||||
->computeDynamicClosingForYear($employee, $ruleCode, $previousYear)
|
||||
;
|
||||
}
|
||||
|
||||
// Freeze the computed closing on the ending exercise's row so the column finally
|
||||
// holds a real, auditable value. The cron is idempotent — it never reaches here for
|
||||
// an already-rolled target year (existing rows are skipped upstream) — so a row that
|
||||
// was corrected manually in the DB afterwards is never overwritten.
|
||||
$previous = $this->leaveBalanceRepository->findOneByEmployeeRuleAndYear($employee, $ruleCode, $previousYear);
|
||||
if (null !== $previous) {
|
||||
$previous->setClosingDays($carryDays);
|
||||
$previous->setClosingSaturdays($carrySaturdays);
|
||||
}
|
||||
|
||||
return [$carryDays, $carrySaturdays];
|
||||
|
||||
Reference in New Issue
Block a user