diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index 96a6b40f71b..f1faf827b34 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -254,6 +254,12 @@ if (empty($reshook)) { $error++; } + $approverslist = $object->fetch_users_approver_holiday(); + if (!in_array($approverid, $approverslist)) { + setEventMessages($langs->transnoentitiesnoconv('InvalidValidator'), null, 'errors'); + $error++; + } + $result = 0; if (!$error) { diff --git a/htdocs/langs/en_US/holiday.lang b/htdocs/langs/en_US/holiday.lang index 04f47c8428d..95c8f54d211 100644 --- a/htdocs/langs/en_US/holiday.lang +++ b/htdocs/langs/en_US/holiday.lang @@ -58,6 +58,7 @@ ConfirmDeleteCP=Confirm the deletion of this leave request? ErrorCantDeleteCP=Error you don't have the right to delete this leave request. CantCreateCP=You don't have the right to make leave requests. InvalidValidatorCP=You must choose the approver for your leave request. +InvalidValidator=The user chosen isn't an approver. NoDateDebut=You must select a start date. NoDateFin=You must select an end date. ErrorDureeCP=Your leave request does not contain working day.