apply feedbacks

This commit is contained in:
steve 2022-03-03 16:18:09 +01:00
parent 8f07c22d70
commit 436b8fa5b5
5 changed files with 33 additions and 62 deletions

View File

@ -141,7 +141,7 @@ function user_prepare_head($object)
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf, $langs, $object, $head, $h, 'user');
if ((!empty($conf->salaries->enabled) && !empty($user->rights->salaries->read) && !empty($user->rights->hrm->read_employee->read))
if ((!empty($conf->salaries->enabled) && !empty($user->rights->salaries->read))
|| (!empty($conf->hrm->enabled) && !empty($user->rights->hrm->employee->read))
|| (!empty($conf->expensereport->enabled) && !empty($user->rights->expensereport->lire) && ($user->id == $object->id || $user->rights->expensereport->readall))
|| (!empty($conf->holiday->enabled) && !empty($user->rights->holiday->read) && ($user->id == $object->id || $user->rights->holiday->readall))

View File

@ -249,22 +249,6 @@ class modHRM extends DolibarrModules
$this->rights[$r][4] = 'compare_advance';
$this->rights[$r][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->hrm->compare_advance->read)
$r++;
// Read employee
$this->rights[$r][0] = 4031; // Permission id (must not be already used)
$this->rights[$r][1] = 'Read employee'; // Permission label
$this->rights[$r][3] = 0; // Permission by default for new user (0/1)
$this->rights[$r][4] = 'read_employee';
$this->rights[$r][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->hrm->read_employee->read)
$r++;
// Write employee
$this->rights[$r][0] = 4032; // Permission id (must not be already used)
$this->rights[$r][1] = 'Write employee'; // Permission label
$this->rights[$r][3] = 0; // Permission by default for new user (0/1)
$this->rights[$r][4] = 'write_employee';
$this->rights[$r][5] = 'write'; // In php code, permission will be checked by test if ($user->rights->hrm->write_employee->write)
$r++;
}
/**

View File

@ -969,8 +969,6 @@ Permission4021=Create/modify your evaluation
Permission4022=Validate evaluation
Permission4023=Delete evaluation
Permission4030=See comparison menu
Permission4031=Read employee
Permission4032=Write employee
Permission10001=Read website content
Permission10002=Create/modify website content (html and javascript content)
Permission10003=Create/modify website content (dynamic php code). Dangerous, must be reserved to restricted developers.

View File

@ -230,6 +230,24 @@ if ($action == 'setpersonal_mobile' && $canadduser && !$cancel) {
}
}
// update ref_employee
if ($action == 'setref_employee' && $canadduser && !$cancel) {
$object->ref_employee = (string) GETPOST('ref_employee', 'alphanohtml');
$result = $object->update($user);
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
}
// update national_registration_number
if ($action == 'setnational_registration_number' && $canadduser && !$cancel) {
$object->national_registration_number = (string) GETPOST('national_registration_number', 'alphanohtml');
$result = $object->update($user);
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
}
if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) {
// update default_c_exp_tax_cat
if ($action == 'setdefault_c_exp_tax_cat' && $canadduser) {
@ -509,17 +527,22 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac
}
// Employee Number
if (!empty($conf->accounting->enabled)) {
print '<tr><td>'.$langs->trans("RefEmployee").'</td>';
print '<td>'.$object->ref_employee.'</td></tr>';
}
print '<tr class="nowrap">';
print '<td>';
print $form->editfieldkey("RefEmployee", 'ref_employee', $object->ref_employee, $object, $user->rights->user->user->creer);
print '</td><td>';
print $form->editfieldval("RefEmployee", 'ref_employee', $object->ref_employee, $object, $user->rights->user->user->creer, 'string', $object->ref_employee);
print '</td>';
print '</tr>';
// National registration number
if (!empty($conf->accounting->enabled)) {
print '<tr><td>'.$langs->trans("NationalRegistrationNumber").'</td>';
print '<td>'.$object->national_registration_number.'</td></tr>';
}
print '<tr class="nowrap">';
print '<td>';
print $form->editfieldkey("NationalRegistrationNumber", 'national_registration_number', $object->national_registration_number, $object, $user->rights->user->user->creer);
print '</td><td>';
print $form->editfieldval("NationalRegistrationNumber", 'national_registration_number', $object->national_registration_number, $object, $user->rights->user->user->creer, 'string', $object->national_registration_number);
print '</td>';
print '</tr>';
print '</table>';

View File

@ -849,18 +849,6 @@ if ($action == 'create' || $action == 'adduserldap') {
}
print '</td></tr>';
// Ref remployee
print '<tr><td>'.$langs->trans("RefEmployee").'</td>';
print '<td>';
print '<input class="minwidth100 maxwidth150onsmartphone" type="text" name="ref_employee" value="'.dol_escape_htmltag(GETPOST('ref_employee', 'alphanohtml')).'">';
print '</td></tr>';
// National registration number
print '<tr><td>'.$langs->trans("NationalRegistrationNumber").'</td>';
print '<td>';
print '<input class="minwidth100 maxwidth150onsmartphone" type="text" name="national_registration_number" value="'.dol_escape_htmltag(GETPOST('national_registration_number', 'alphanohtml')).'">';
print '</td></tr>';
// Login
print '<tr><td><span class="fieldrequired">'.$langs->trans("Login").'</span></td>';
print '<td>';
@ -2099,28 +2087,6 @@ if ($action == 'create' || $action == 'adduserldap') {
}
print '</td></tr>';
// Ref employee
print "<tr>".'<td>'.$langs->trans("RefEmployee").'</td>';
print '<td>';
if ($caneditfield && !$object->ldap_sid) {
print '<input class="minwidth100" type="text" class="flat" name="ref_employee" value="'.$object->ref_employee.'">';
} else {
print '<input type="hidden" name="ref_employee" value="'.$object->ref_employee.'">';
print $object->ref_employee;
}
print '</td></tr>';
// National registration number
print "<tr>".'<td>'.$langs->trans("NationalRegistrationNumber").'</td>';
print '<td>';
if ($caneditfield && !$object->ldap_sid) {
print '<input class="minwidth100" type="text" class="flat" name="national_registration_number" value="'.$object->national_registration_number.'">';
} else {
print '<input type="hidden" name="national_registration_number" value="'.$object->national_registration_number.'">';
print $object->national_registration_number;
}
print '</td></tr>';
// Login
print "<tr>".'<td><span class="fieldrequired">'.$langs->trans("Login").'</span></td>';
print '<td>';