From 9048c9947806388ff361468ecba3599e24bc1ec7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 22 Sep 2022 18:38:55 +0200 Subject: [PATCH] FIX User approver not visible on holiday --- htdocs/holiday/card.php | 14 ++++++++------ htdocs/main.inc.php | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index 3cc05be2068..36dd86241f0 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -1150,7 +1150,7 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') { $result = $object->fetch($id, $ref); $approverexpected = new User($db); - $approverexpected->fetch($object->fk_validator); + $approverexpected->fetch($object->fk_validator); // Use that should be the approver $userRequest = new User($db); $userRequest->fetch($object->fk_user); @@ -1364,21 +1364,23 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') { print ''; print ''; if ($object->statut == Holiday::STATUS_APPROVED || $object->statut == Holiday::STATUS_CANCELED) { - $approverdone = new User($db); - $approverdone->fetch($object->fk_user_valid); - print $approverdone->getNomUrl(-1); + if ($object->fk_user_approve > 0) { + $approverdone = new User($db); + $approverdone->fetch($object->fk_user_approve); + print $approverdone->getNomUrl(-1); + } } else { print $approverexpected->getNomUrl(-1); } $include_users = $object->fetch_users_approver_holiday(); if (is_array($include_users) && in_array($user->id, $include_users) && $object->statut == Holiday::STATUS_VALIDATED) { - print ''.img_edit($langs->trans("Edit")).''; + print ''.img_edit($langs->trans("Edit")).''; } print ''; print ''; } else { print ''; - print ''.$langs->trans('ReviewedByCP').''; + print ''.$langs->trans('ReviewedByCP').''; // Will be approved by print ''; $include_users = $object->fetch_users_approver_holiday(); if (!in_array($object->fk_validator, $include_users)) { // Add the current validator to the list to not lose it when editing. diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 870088efe93..16e3f006d3d 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -518,7 +518,7 @@ if ((!defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && getDolGlobalInt( $sensitiveget = false; if ((GETPOSTISSET('massaction') || GETPOST('action', 'aZ09')) && getDolGlobalInt('MAIN_SECURITY_CSRF_WITH_TOKEN') >= 3) { // All GET actions and mass actions are processed as sensitive. - if (GETPOSTISSET('massaction') || !in_array(GETPOST('action', 'aZ09'), array('create', 'createsite', 'edit', 'file_manager', 'presend', 'presend_addmessage'))) { // We exclude the case action='create' and action='file_manager' that are legitimate + if (GETPOSTISSET('massaction') || !in_array(GETPOST('action', 'aZ09'), array('create', 'createsite', 'edit', 'editvalidator', 'file_manager', 'presend', 'presend_addmessage'))) { // We exclude the case action='create' and action='file_manager' that are legitimate $sensitiveget = true; } } elseif (getDolGlobalInt('MAIN_SECURITY_CSRF_WITH_TOKEN') >= 2) {