fix: change Read and Write employee label with personal information

This commit is contained in:
steve 2022-03-30 12:10:06 +02:00
parent 21090963e0
commit 8f39efd2b9
3 changed files with 24 additions and 24 deletions

View File

@ -252,18 +252,18 @@ class modHRM extends DolibarrModules
// 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][1] = 'Read personal information'; // 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)
$this->rights[$r][4] = 'read_personal_information';
$this->rights[$r][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->hrm->read_personal_information->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][1] = 'Write personal information'; // 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)
$this->rights[$r][4] = 'write_personal_information';
$this->rights[$r][5] = 'write'; // In php code, permission will be checked by test if ($user->rights->hrm->write_personal_information->write)
$r++;
}

View File

@ -969,8 +969,8 @@ Permission4021=Create/modify your evaluation
Permission4022=Validate evaluation
Permission4023=Delete evaluation
Permission4030=See comparison menu
Permission4031=Read employee
Permission4032=Write employee
Permission4031=Read personal information
Permission4032=Write personal information
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

@ -78,8 +78,8 @@ if (empty($account->userid)) {
// Define value to know what current user can do on users
$canadduser = (!empty($user->admin) || $user->rights->user->user->creer || $user->rights->hrm->write_employee->write);
$canreaduser = (!empty($user->admin) || $user->rights->user->user->lire || $user->rights->hrm->read_employee->read);
$canadduser = (!empty($user->admin) || $user->rights->user->user->creer || $user->rights->hrm->write_personal_information->write);
$canreaduser = (!empty($user->admin) || $user->rights->user->user->lire || $user->rights->hrm->read_personal_information->read);
$permissiontoaddbankaccount = (!empty($user->rights->salaries->write) || !empty($user->rights->hrm->employee->write) || !empty($user->rights->user->creer));
// Ok if user->rights->salaries->read or user->rights->hrm->read
@ -281,7 +281,7 @@ llxHeader(null, $langs->trans("BankAccounts"));
$head = user_prepare_head($object);
if ($id && $bankid && $action == 'edit' && ($user->rights->user->user->creer || $user->rights->hrm->write_employee->write)) {
if ($id && $bankid && $action == 'edit' && ($user->rights->user->user->creer || $user->rights->hrm->write_personal_information->write)) {
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'" method="post">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="update">';
@ -446,7 +446,7 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac
print "</tr>\n";
// Date of birth
if ($user->rights->hrm->read_employee->read || $user->rights->hrm->write_employee->write) {
if ($user->rights->hrm->read_personal_information->read || $user->rights->hrm->write_personal_information->write) {
print '<tr>';
print '<td>';
print $form->editfieldkey("DateOfBirth", 'birth', $object->birth, $object, $user->rights->user->user->creer);
@ -457,23 +457,23 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac
}
// Personal email
if ($user->rights->hrm->read_employee->read || $user->rights->hrm->write_employee->write) {
if ($user->rights->hrm->read_personal_information->read || $user->rights->hrm->write_personal_information->write) {
print '<tr class="nowrap">';
print '<td>';
print $form->editfieldkey("UserPersonalEmail", 'personal_email', $object->personal_email, $object, $user->rights->user->user->creer || $user->rights->hrm->write_employee->write);
print $form->editfieldkey("UserPersonalEmail", 'personal_email', $object->personal_email, $object, $user->rights->user->user->creer || $user->rights->hrm->write_personal_information->write);
print '</td><td>';
print $form->editfieldval("UserPersonalEmail", 'personal_email', $object->personal_email, $object, $user->rights->user->user->creer || $user->rights->hrm->write_employee->write, 'email', '', null, null, '', 0, 'dol_print_email');
print $form->editfieldval("UserPersonalEmail", 'personal_email', $object->personal_email, $object, $user->rights->user->user->creer || $user->rights->hrm->write_personal_information->write, 'email', '', null, null, '', 0, 'dol_print_email');
print '</td>';
print '</tr>';
}
// Personal phone
if ($user->rights->hrm->read_employee->read || $user->rights->hrm->write_employee->write) {
if ($user->rights->hrm->read_personal_information->read || $user->rights->hrm->write_personal_information->write) {
print '<tr class="nowrap">';
print '<td>';
print $form->editfieldkey("UserPersonalMobile", 'personal_mobile', $object->personal_mobile, $object, $user->rights->user->user->creer || $user->rights->hrm->write_employee->write);
print $form->editfieldkey("UserPersonalMobile", 'personal_mobile', $object->personal_mobile, $object, $user->rights->user->user->creer || $user->rights->hrm->write_personal_information->write);
print '</td><td>';
print $form->editfieldval("UserPersonalMobile", 'personal_mobile', $object->personal_mobile, $object, $user->rights->user->user->creer || $user->rights->hrm->write_employee->write, 'string', '', null, null, '', 0, 'dol_print_phone');
print $form->editfieldval("UserPersonalMobile", 'personal_mobile', $object->personal_mobile, $object, $user->rights->user->user->creer || $user->rights->hrm->write_personal_information->write, 'string', '', null, null, '', 0, 'dol_print_phone');
print '</td>';
print '</tr>';
}
@ -533,23 +533,23 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac
}
// Employee Number
if ($user->rights->hrm->read_employee->read || $user->rights->hrm->write_employee->write) {
if ($user->rights->hrm->read_personal_information->read || $user->rights->hrm->write_personal_information->write) {
print '<tr class="nowrap">';
print '<td>';
print $form->editfieldkey("RefEmployee", 'ref_employee', $object->ref_employee, $object, $user->rights->user->user->creer || $user->rights->hrm->write_employee->write);
print $form->editfieldkey("RefEmployee", 'ref_employee', $object->ref_employee, $object, $user->rights->user->user->creer || $user->rights->hrm->write_personal_information->write);
print '</td><td>';
print $form->editfieldval("RefEmployee", 'ref_employee', $object->ref_employee, $object, $user->rights->user->user->creer || $user->rights->hrm->write_employee->write, 'string', $object->ref_employee);
print $form->editfieldval("RefEmployee", 'ref_employee', $object->ref_employee, $object, $user->rights->user->user->creer || $user->rights->hrm->write_personal_information->write, 'string', $object->ref_employee);
print '</td>';
print '</tr>';
}
// National registration number
if ($user->rights->hrm->read_employee->read || $user->rights->hrm->write_employee->write) {
if ($user->rights->hrm->read_personal_information->read || $user->rights->hrm->write_personal_information->write) {
print '<tr class="nowrap">';
print '<td>';
print $form->editfieldkey("NationalRegistrationNumber", 'national_registration_number', $object->national_registration_number, $object, $user->rights->user->user->creer || $user->rights->hrm->write_employee->write);
print $form->editfieldkey("NationalRegistrationNumber", 'national_registration_number', $object->national_registration_number, $object, $user->rights->user->user->creer || $user->rights->hrm->write_personal_information->write);
print '</td><td>';
print $form->editfieldval("NationalRegistrationNumber", 'national_registration_number', $object->national_registration_number, $object, $user->rights->user->user->creer || $user->rights->hrm->write_employee->write, 'string', $object->national_registration_number);
print $form->editfieldval("NationalRegistrationNumber", 'national_registration_number', $object->national_registration_number, $object, $user->rights->user->user->creer || $user->rights->hrm->write_personal_information->write, 'string', $object->national_registration_number);
print '</td>';
print '</tr>';
}