Merge pull request #12015 from atm-maxime/new_validators
NEW expense request and holiday validator fields
This commit is contained in:
commit
76aef85ee4
@ -1491,7 +1491,7 @@ if ($action == 'create')
|
||||
if (empty($include_users)) print img_warning().' '.$langs->trans("NobodyHasPermissionToValidateExpenseReport");
|
||||
else
|
||||
{
|
||||
$defaultselectuser=$user->fk_user; // Will work only if supervisor has permission to approve so is inside include_users
|
||||
$defaultselectuser=(empty($user->fk_user_expense_validator) ? $user->fk_user : $user->fk_user_expense_validator); // Will work only if supervisor has permission to approve so is inside include_users
|
||||
if (! empty($conf->global->EXPENSEREPORT_DEFAULT_VALIDATOR)) $defaultselectuser=$conf->global->EXPENSEREPORT_DEFAULT_VALIDATOR; // Can force default approver
|
||||
if (GETPOST('fk_user_validator', 'int') > 0) $defaultselectuser=GETPOST('fk_user_validator', 'int');
|
||||
$s=$form->select_dolusers($defaultselectuser, "fk_user_validator", 1, "", ((empty($defaultselectuser) || empty($conf->global->EXPENSEREPORT_DEFAULT_VALIDATOR_UNCHANGEABLE))?0:1), $include_users);
|
||||
|
||||
@ -1091,7 +1091,7 @@ if ((empty($id) && empty($ref)) || $action == 'add' || $action == 'request' || $
|
||||
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
|
||||
$defaultselectuser=(empty($user->fk_user_holiday_validator) ? $user->fk_user : $user->fk_user_holiday_validator); // 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);
|
||||
|
||||
@ -109,4 +109,7 @@ UserLogoff=User logout
|
||||
UserLogged=User logged
|
||||
DateEmployment=Employment Start Date
|
||||
DateEmploymentEnd=Employment End Date
|
||||
CantDisableYourself=You can't disable your own user record
|
||||
CantDisableYourself=You can't disable your own user record
|
||||
UserExpenseValidator=Expense report validator
|
||||
UserHolidayValidator=Leave request validator
|
||||
ValidatorIsSupervisorByDefault=By default, the supervisor is the validator for expense reports and leave requests
|
||||
|
||||
@ -223,6 +223,8 @@ if (empty($reshook)) {
|
||||
$object->note = GETPOST("note", 'none');
|
||||
$object->ldap_sid = GETPOST("ldap_sid", 'alphanohtml');
|
||||
$object->fk_user = GETPOST("fk_user", 'int') > 0 ? GETPOST("fk_user", 'int') : 0;
|
||||
$object->fk_user_expense_validator = GETPOST("fk_user_expense_validator", 'int') > 0 ? GETPOST("fk_user_expense_validator", 'int') : 0;
|
||||
$object->fk_user_holiday_validator = GETPOST("fk_user_holiday_validator", 'int') > 0 ? GETPOST("fk_user_holiday_validator", 'int') : 0;
|
||||
$object->employee = GETPOST('employee', 'alphanohtml');
|
||||
|
||||
$object->thm = GETPOST("thm", 'alphanohtml') != '' ? GETPOST("thm", 'alphanohtml') : '';
|
||||
@ -376,6 +378,8 @@ if (empty($reshook)) {
|
||||
$object->accountancy_code = GETPOST("accountancy_code", 'alphanohtml');
|
||||
$object->openid = GETPOST("openid", 'alphanohtml');
|
||||
$object->fk_user = GETPOST("fk_user", 'int') > 0 ? GETPOST("fk_user", 'int') : 0;
|
||||
$object->fk_user_expense_validator = GETPOST("fk_user_expense_validator", 'int') > 0 ? GETPOST("fk_user_expense_validator", 'int') : 0;
|
||||
$object->fk_user_holiday_validator = GETPOST("fk_user_holiday_validator", 'int') > 0 ? GETPOST("fk_user_holiday_validator", 'int') : 0;
|
||||
$object->employee = GETPOST('employee', 'int');
|
||||
|
||||
$object->thm = GETPOST("thm", 'alphanohtml') != '' ? GETPOST("thm", 'alphanohtml') : '';
|
||||
@ -965,6 +969,32 @@ if ($action == 'create' || $action == 'adduserldap')
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Expense report validator
|
||||
if(!empty($conf->expensereport->enabled))
|
||||
{
|
||||
print '<tr><td class="titlefieldcreate">';
|
||||
$text = $langs->trans("UserExpenseValidator");
|
||||
print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help');
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print $form->select_dolusers($object->fk_user_expense_validator, 'fk_user_expense_validator', 1, array($object->id), 0, '', 0, $conf->entity, 0, 0, '', 0, '', 'maxwidth300');
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
// Holiday request validator
|
||||
if(!empty($conf->holiday->enabled))
|
||||
{
|
||||
print '<tr><td class="titlefieldcreate">';
|
||||
$text = $langs->trans("UserHolidayValidator");
|
||||
print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help');
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print $form->select_dolusers($object->fk_user_holiday_validator, 'fk_user_holiday_validator', 1, array($object->id), 0, '', 0, $conf->entity, 0, 0, '', 0, '', 'maxwidth300');
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
|
||||
print '</table><hr><table class="border centpercent">';
|
||||
|
||||
@ -1562,6 +1592,36 @@ else
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Expense report validator
|
||||
print '<tr><td>';
|
||||
$text = $langs->trans("UserExpenseValidator");
|
||||
print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help');
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if (empty($object->fk_user_expense_validator)) print $langs->trans("None");
|
||||
else {
|
||||
$evuser=new User($db);
|
||||
$evuser->fetch($object->fk_user_expense_validator);
|
||||
print $evuser->getNomUrl(1);
|
||||
}
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Holiday request validator
|
||||
print '<tr><td>';
|
||||
$text = $langs->trans("UserHolidayValidator");
|
||||
print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help');
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if (empty($object->fk_user_holiday_validator)) print $langs->trans("None");
|
||||
else {
|
||||
$hvuser=new User($db);
|
||||
$hvuser->fetch($object->fk_user_holiday_validator);
|
||||
print $hvuser->getNomUrl(1);
|
||||
}
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Position/Job
|
||||
print '<tr><td>'.$langs->trans("PostOrFunction").'</td>';
|
||||
print '<td>'.$object->job.'</td>';
|
||||
@ -2243,6 +2303,46 @@ else
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Expense report validator
|
||||
print '<tr><td class="titlefield">';
|
||||
$text = $langs->trans("UserExpenseValidator");
|
||||
print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help');
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if ($caneditfield)
|
||||
{
|
||||
print $form->select_dolusers($object->fk_user_expense_validator, 'fk_user_expense_validator', 1, array($object->id), 0, '', 0, $object->entity, 0, 0, '', 0, '', 'maxwidth300');
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input type="hidden" name="fk_user_expense_validator" value="'.$object->fk_user_expense_validator.'">';
|
||||
$evuser=new User($db);
|
||||
$evuser->fetch($object->fk_user_expense_validator);
|
||||
print $evuser->getNomUrl(1);
|
||||
}
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Holiday request validator
|
||||
print '<tr><td class="titlefield">';
|
||||
$text = $langs->trans("UserHolidayValidator");
|
||||
print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help');
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if ($caneditfield)
|
||||
{
|
||||
print $form->select_dolusers($object->fk_user_holiday_validator, 'fk_user_holiday_validator', 1, array($object->id), 0, '', 0, $object->entity, 0, 0, '', 0, '', 'maxwidth300');
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input type="hidden" name="fk_user_holiday_validator" value="'.$object->fk_user_holiday_validator.'">';
|
||||
$hvuser=new User($db);
|
||||
$hvuser->fetch($object->fk_user_holiday_validator);
|
||||
print $hvuser->getNomUrl(1);
|
||||
}
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
print '</table><hr><table class="border centpercent">';
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user