Fix permission
This commit is contained in:
parent
f04a07b6a7
commit
77c286b769
@ -758,7 +758,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;
|
||||
@ -1466,7 +1466,7 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') {
|
||||
print '<a href="#" class="butActionRefused classfortooltip" title="'.$langs->trans("NotTheAssignedApprover").'">'.$langs->trans("ActionRefuseCP").'</a>';
|
||||
|
||||
// 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 '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=cancel&token='.newToken().'" class="butAction">'.$langs->trans("ActionCancelCP").'</a>';
|
||||
} else {
|
||||
@ -1475,15 +1475,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 '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=cancel&token='.newToken().'" class="butAction">'.$langs->trans("ActionCancelCP").'</a>';
|
||||
} else {
|
||||
print '<a href="#" class="butActionRefused classfortooltip" title="'.$langs->trans("HolidayStarted").'-'.$langs->trans("NotAllowed").'">'.$langs->trans("ActionCancelCP").'</a>';
|
||||
}
|
||||
} 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 '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=cancel&token='.newToken().'" class="butAction">'.$langs->trans("ActionCancelCP").'</a>';
|
||||
} else {
|
||||
print '<a href="#" class="butActionRefused classfortooltip" title="'.$langs->trans("NotAllowed").'">'.$langs->trans("ActionCancelCP").'</a>';
|
||||
@ -1491,7 +1491,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 '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=backtodraft" class="butAction">'.$langs->trans("SetToDraft").'</a>';
|
||||
}
|
||||
if ($candelete && ($object->statut == Holiday::STATUS_DRAFT || $object->statut == Holiday::STATUS_CANCELED || $object->statut == Holiday::STATUS_REFUSED)) { // If draft or canceled or refused
|
||||
|
||||
Loading…
Reference in New Issue
Block a user