From 89f254eb35b990c9202f5af41812164e374fe634 Mon Sep 17 00:00:00 2001 From: ATM-Lucas Date: Mon, 15 Dec 2025 15:21:57 +0100 Subject: [PATCH 1/3] Can Validated Holidays When Negative Balance --- htdocs/holiday/class/holiday.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 9bcbb6c2f7d..9c7bc5e7113 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_between_day($this->date_debut, $this->date_fin); + if ($balance - $days < 0 && getDolGlobalString('HOLIDAY_DISALLOW_NEGATIVE_BALANCE')) { $this->error = 'LeaveRequestCreationBlockedBecauseBalanceIsNegative'; return -1; } From e40c6b7c5f07b01905341a80fe508bae59788ab6 Mon Sep 17 00:00:00 2001 From: ATM-Lucas Date: Mon, 15 Dec 2025 15:57:24 +0100 Subject: [PATCH 2/3] user num open day --- htdocs/holiday/class/holiday.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 9c7bc5e7113..812063d3f42 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -776,7 +776,7 @@ class Holiday extends CommonObject if ($checkBalance > 0) { $balance = $this->getCPforUser($this->fk_user, $this->fk_type); - $days = num_between_day($this->date_debut, $this->date_fin); + $days = num_open_day($this->date_debut, $this->date_fin); if ($balance - $days < 0 && getDolGlobalString('HOLIDAY_DISALLOW_NEGATIVE_BALANCE')) { $this->error = 'LeaveRequestCreationBlockedBecauseBalanceIsNegative'; return -1; From bb7502d880e35aaa62f41df2f3dc84755419c4c7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 16 Dec 2025 01:10:28 +0100 Subject: [PATCH 3/3] Fix condition check for negative balance --- htdocs/holiday/class/holiday.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 812063d3f42..a66e9057937 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -777,7 +777,7 @@ class Holiday extends CommonObject $balance = $this->getCPforUser($this->fk_user, $this->fk_type); $days = num_open_day($this->date_debut, $this->date_fin); - if ($balance - $days < 0 && getDolGlobalString('HOLIDAY_DISALLOW_NEGATIVE_BALANCE')) { + if ((($balance - $days) < 0) && getDolGlobalString('HOLIDAY_DISALLOW_NEGATIVE_BALANCE')) { $this->error = 'LeaveRequestCreationBlockedBecauseBalanceIsNegative'; return -1; }