diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 9bcbb6c2f7d..a66e9057937 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -775,7 +775,9 @@ class Holiday extends CommonObject if ($checkBalance > 0) { $balance = $this->getCPforUser($this->fk_user, $this->fk_type); - if ($balance < 0) { + + $days = num_open_day($this->date_debut, $this->date_fin); + if ((($balance - $days) < 0) && getDolGlobalString('HOLIDAY_DISALLOW_NEGATIVE_BALANCE')) { $this->error = 'LeaveRequestCreationBlockedBecauseBalanceIsNegative'; return -1; }