Merge pull request #36661 from atm-lucasmantegari/FIX/CanValidatedHolidaysWhenNegativeBalance

FIX - Can Validated Holidays When Negative Balance
This commit is contained in:
Laurent Destailleur 2025-12-16 01:32:09 +01:00 committed by GitHub
commit ec91c8ddd2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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;
}