feat : ajout des congés bonus pour les forfaits si ils travaillent un weekend ou férié
This commit is contained in:
@@ -535,10 +535,21 @@ final readonly class EmployeeLeaveSummaryProvider implements ProviderInterface
|
||||
$type = $employee->getContract()?->getType();
|
||||
if (ContractType::FORFAIT === $type) {
|
||||
$businessDaysInPeriod = $this->countBusinessDays($from, $to);
|
||||
$publicHolidays = $this->buildPublicHolidayMap($from, $to);
|
||||
$weekdayHolidays = array_filter(
|
||||
array_keys($publicHolidays),
|
||||
static fn (string $date): bool => (int) new DateTimeImmutable($date)->format('N') <= 5
|
||||
);
|
||||
$bonusDays = $this->workHourRepository->countWeekendAndHolidayWorkedDays(
|
||||
$employee,
|
||||
$from,
|
||||
$to,
|
||||
array_values($weekdayHolidays)
|
||||
);
|
||||
|
||||
return [
|
||||
'ruleCode' => LeaveRuleCode::FORFAIT_218->value,
|
||||
'acquiredDays' => (float) max(0, $businessDaysInPeriod - self::FORFAIT_TARGET_WORKED_DAYS),
|
||||
'acquiredDays' => (float) max(0, $businessDaysInPeriod - self::FORFAIT_TARGET_WORKED_DAYS) + $bonusDays,
|
||||
'acquiredSaturdays' => 0.0,
|
||||
'accrualPerMonth' => 0.0,
|
||||
'saturdayAccrualPerMonth' => 0.0,
|
||||
|
||||
Reference in New Issue
Block a user