fix: if holiday type have bock if negative, it is ignored when balance is 0 (#36817)
* fix: backport of holiday approval if block_if_negative * fix: backport of holiday approval if block_if_negative
This commit is contained in:
parent
53b07f760b
commit
2dbc4c5e01
2 changed files with 5 additions and 4 deletions
|
|
@ -687,13 +687,13 @@ if (empty($reshook)) {
|
|||
|
||||
if (!$error) {
|
||||
$db->commit();
|
||||
|
||||
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
|
||||
exit;
|
||||
} else {
|
||||
$db->rollback();
|
||||
$action = '';
|
||||
}
|
||||
|
||||
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -882,8 +882,9 @@ class Holiday extends CommonObject
|
|||
|
||||
if ($checkBalance > 0) {
|
||||
$balance = $this->getCPforUser($this->fk_user, $this->fk_type);
|
||||
$daysAsked = num_open_day($this->date_debut, $this->date_fin, 0, 1);
|
||||
|
||||
if ($balance < 0) {
|
||||
if (($balance - $daysAsked) < 0) {
|
||||
$this->error = 'LeaveRequestCreationBlockedBecauseBalanceIsNegative';
|
||||
return -1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue