diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index 982eacd19c4..dab043c9ee2 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -530,11 +530,15 @@ if (empty($reshook)) { } // option to notify the validator if the balance is less than the request + // (only for leave types that actually use the balance counter) if (!getDolGlobalString('HOLIDAY_HIDE_APPROVER_ABOUT_NEGATIVE_BALANCE')) { - $nbopenedday = num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday); + $affectingtypes = $object->getTypes(1, 1); + if (!empty($affectingtypes[$object->fk_type])) { + $nbopenedday = num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday); - if ($nbopenedday > $object->getCPforUser($object->fk_user, $object->fk_type)) { - $message .= "
".$langs->transnoentities("HolidaysToValidateAlertSolde")."
\n"; + if ($nbopenedday > $object->getCPforUser($object->fk_user, $object->fk_type)) { + $message .= "".$langs->transnoentities("HolidaysToValidateAlertSolde")."
\n"; + } } } diff --git a/htdocs/holiday/card_group.php b/htdocs/holiday/card_group.php index f6c3df2aadb..782d2b6e409 100644 --- a/htdocs/holiday/card_group.php +++ b/htdocs/holiday/card_group.php @@ -757,11 +757,15 @@ function sendMail($id, $cancreate, $now, $autoValidation) } // option to notify the validator if the balance is less than the request + // (only for leave types that actually use the balance counter) if (!getDolGlobalString('HOLIDAY_HIDE_APPROVER_ABOUT_NEGATIVE_BALANCE')) { - $nbopenedday = num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday); + $affectingtypes = $object->getTypes(1, 1); + if (!empty($affectingtypes[$object->fk_type])) { + $nbopenedday = num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday); - if ($nbopenedday > $object->getCPforUser($object->fk_user, $object->fk_type)) { - $message .= "".$langs->transnoentities("HolidaysToValidateAlertSolde")."
\n"; + if ($nbopenedday > $object->getCPforUser($object->fk_user, $object->fk_type)) { + $message .= "".$langs->transnoentities("HolidaysToValidateAlertSolde")."
\n"; + } } }