diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index 4df9b32278b..1c357d8b759 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -773,7 +773,7 @@ if (empty($reshook)) { // If status pending validation and validator = validator or user, or rights to do for others if (($object->statut == Holiday::STATUS_VALIDATED || $object->statut == Holiday::STATUS_APPROVED) && - (!empty($user->admin) || $user->id == $object->fk_validator || in_array($object->fk_user, $childids) || $cancreateall)) { + (!empty($user->admin) || $user->id == $object->fk_validator || $cancreate || $cancreateall)) { $db->begin(); $oldstatus = $object->statut; @@ -1471,7 +1471,7 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') { print ''.$langs->trans("ActionRefuseCP").''; // Button Cancel (because we can't approve) - if (in_array($object->fk_user, $childids) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->holiday->writeall_advance))) { + if ($cancreate || $cancreateall) { if (($object->date_debut > dol_now()) || !empty($user->admin)) { print ''.$langs->trans("ActionCancelCP").''; } else { @@ -1480,15 +1480,15 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') { } } } - if ($object->statut == Holiday::STATUS_APPROVED) { // If validated or approved - if ($user->id == $object->fk_validator || in_array($object->fk_user, $childids) || $cancreateall) { + if ($object->statut == Holiday::STATUS_APPROVED) { // If validated and approved + if ($user->id == $object->fk_validator || $cancreate || $cancreateall) { if (($object->date_debut > dol_now()) || !empty($user->admin)) { print ''.$langs->trans("ActionCancelCP").''; } else { print 'trans("NotAllowed").'">'.$langs->trans("ActionCancelCP").''; } } else { // I have no rights on the user of the holiday. - if (!empty($user->admin)) { // If current validator can't cancel an approved leave, we allow admin user + if (!empty($user->admin)) { // If current approver can't cancel an approved leave, we allow admin user print ''.$langs->trans("ActionCancelCP").''; } else { print ''.$langs->trans("ActionCancelCP").''; @@ -1496,7 +1496,7 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') { } } - if ($cancreate && $object->statut == Holiday::STATUS_CANCELED) { + if (($cancreate || $cancreateall) && $object->statut == Holiday::STATUS_CANCELED) { print ''.$langs->trans("SetToDraft").''; } if ($candelete && ($object->statut == Holiday::STATUS_DRAFT || $object->statut == Holiday::STATUS_CANCELED || $object->statut == Holiday::STATUS_REFUSED)) { // If draft or canceled or refused