diff --git a/htdocs/core/modules/modHoliday.class.php b/htdocs/core/modules/modHoliday.class.php index 3fd056b525e..e60be690ce4 100644 --- a/htdocs/core/modules/modHoliday.class.php +++ b/htdocs/core/modules/modHoliday.class.php @@ -108,42 +108,49 @@ class modHoliday extends DolibarrModules $r=0; $this->rights[$r][0] = 20001; // Permission id (must not be already used) - $this->rights[$r][1] = 'Read your own holidays'; // Permission label + $this->rights[$r][1] = 'Read your own leave requests'; // Permission label $this->rights[$r][3] = 0; // Permission by default for new user (0/1) $this->rights[$r][4] = 'read'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) $r++; $this->rights[$r][0] = 20002; // Permission id (must not be already used) - $this->rights[$r][1] = 'Create/modify your own holidays'; // Permission label + $this->rights[$r][1] = 'Create/modify your own leave requests'; // Permission label $this->rights[$r][3] = 0; // Permission by default for new user (0/1) $this->rights[$r][4] = 'write'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) $r++; $this->rights[$r][0] = 20003; // Permission id (must not be already used) - $this->rights[$r][1] = 'Delete holidays'; // Permission label + $this->rights[$r][1] = 'Delete leave requests'; // Permission label $this->rights[$r][3] = 0; // Permission by default for new user (0/1) $this->rights[$r][4] = 'delete'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) $r++; + $this->rights[$r][0] = 20007; + $this->rights[$r][1] = 'Approve leave requests'; + $this->rights[$r][2] = 'w'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'approve'; + $r++; + $this->rights[$r][0] = 20004; // Permission id (must not be already used) - $this->rights[$r][1] = 'Read holidays for everybody'; // Permission label + $this->rights[$r][1] = 'Read leave requests for everybody'; // Permission label $this->rights[$r][3] = 0; // Permission by default for new user (0/1) $this->rights[$r][4] = 'read_all'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) $r++; $this->rights[$r][0] = 20005; // Permission id (must not be already used) - $this->rights[$r][1] = 'Create/modify holidays for everybody'; // Permission label + $this->rights[$r][1] = 'Create/modify leave requests for everybody'; // Permission label $this->rights[$r][3] = 0; // Permission by default for new user (0/1) $this->rights[$r][4] = 'write_all'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) $r++; $this->rights[$r][0] = 20006; // Permission id (must not be already used) - $this->rights[$r][1] = 'Setup holidays of users (setup and update balance)'; // Permission label + $this->rights[$r][1] = 'Setup leave requests of users (setup and update balance)'; // Permission label $this->rights[$r][3] = 0; // Permission by default for new user (0/1) $this->rights[$r][4] = 'define_holiday'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index a2d67d627c0..d17ae2eb095 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -1346,6 +1346,7 @@ if ($action == 'create') print ''; print ''; + // User for expense report print '
| '.$langs->trans("User").' | '; print ''; @@ -932,11 +931,24 @@ if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create print ' | '; print '
| '.$langs->trans("ReviewedByCP").' | '; print ''; - print $form->select_dolusers((GETPOST('valideur','int')>0?GETPOST('valideur','int'):$user->fk_user), "valideur", 1, ($user->admin ? '' : array($user->id)), 0, '', 0, 0, 0, 0, '', 0, '', '', 1); // By default, hierarchical parent + + $object = new Holiday($db); + $include_users = $object->fetch_users_approver_holiday(); + if (empty($include_users)) print img_warning().' '.$langs->trans("NobodyHasPermissionToValidateHolidays"); + else + { + $defaultselectuser=$user->fk_user; // Will work only if supervisor has permission to approve so is inside include_users + if (! empty($conf->global->HOLIDAY_DEFAULT_VALIDATOR)) $defaultselectuser=$conf->global->HOLIDAY_DEFAULT_VALIDATOR; // Can force default approver + if (GETPOST('valideur', 'int') > 0) $defaultselectuser=GETPOST('valideur', 'int'); + $s=$form->select_dolusers($defaultselectuser, "valideur", 1, "", 0, $include_users); + print $form->textwithpicto($s, $langs->trans("AnyOtherInThisListCanValidate")); + } + + //print $form->select_dolusers((GETPOST('valideur','int')>0?GETPOST('valideur','int'):$user->fk_user), "valideur", 1, ($user->admin ? '' : array($user->id)), 0, '', 0, 0, 0, 0, '', 0, '', '', 1); // By default, hierarchical parent print ' | '; print '
| '.$langs->trans('ReviewedByCP').' | '; print ''; - print $form->select_dolusers($object->fk_validator, "valideur", 1, ($user->admin ? '' : array($user->id))); // By default, hierarchical parent + $include_users = $object->fetch_users_approver_holiday(); + if (empty($include_users)) print img_warning().' '.$langs->trans("NobodyHasPermissionToValidateHolidays"); + else + { + $s=$form->select_dolusers($object->fk_validator, "valideur", 1, ($user->admin ? '' : array($user->id)), 0, $include_users); + print $form->textwithpicto($s, $langs->trans("AnyOtherInThisListCanValidate")); + } print ' | '; print '