@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | $dateendvalidity = dol_mktime(0, 0, 0, GETPOSTINT('dateendvaliditymonth'), GETPOSTINT('dateendvalidityday'), GETPOSTINT('dateendvalidityyear')); |
96 | 96 | $dateofbirth = dol_mktime(0, 0, 0, GETPOSTINT('dateofbirthmonth'), GETPOSTINT('dateofbirthday'), GETPOSTINT('dateofbirthyear')); |
97 | 97 | |
98 | -$childids = $user->getAllChildIds(1); // For test on hrm fields (like salary visibility) |
|
98 | +$childids = $user->getAllChildIds(1); // For test on hrm fields (like salary visibility) |
|
99 | 99 | |
100 | 100 | $object = new User($db); |
101 | 101 | $extrafields = new ExtraFields($db); |
@@ -159,8 +159,8 @@ discard block |
||
159 | 159 | if ($id > 0) { |
160 | 160 | // $user is the current logged user, $id is the user we want to edit |
161 | 161 | $permissiontoedit = ((($user->id == $id) && $user->hasRight("user", "self", "write")) || (($user->id != $id) && $user->hasRight("user", "user", "write"))) && (empty($user->socid) || $user->socid == $object->socid); |
162 | - $permissiontoeditpasswordandsee = ((($user->id == $id) && $user->hasRight("user", "self", "password")) || (($user->id != $id) && $user->hasRight("user", "user", "password") && $user->admin))&& (empty($user->socid) || $user->socid == $object->socid); |
|
163 | - $permissiontoeditpasswordandsend = ((($user->id == $id) && $user->hasRight("user", "self", "password")) || (($user->id != $id) && $user->hasRight("user", "user", "password")))&& (empty($user->socid) || $user->socid == $object->socid); |
|
162 | + $permissiontoeditpasswordandsee = ((($user->id == $id) && $user->hasRight("user", "self", "password")) || (($user->id != $id) && $user->hasRight("user", "user", "password") && $user->admin)) && (empty($user->socid) || $user->socid == $object->socid); |
|
163 | + $permissiontoeditpasswordandsend = ((($user->id == $id) && $user->hasRight("user", "self", "password")) || (($user->id != $id) && $user->hasRight("user", "user", "password"))) && (empty($user->socid) || $user->socid == $object->socid); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | $passwordismodified = false; |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | if (!$error) { |
449 | 449 | $object->fetch($id); |
450 | 450 | |
451 | - $object->oldcopy = clone $object; // @phan-suppress-current-line PhanTypeMismatchProperty |
|
451 | + $object->oldcopy = clone $object; // @phan-suppress-current-line PhanTypeMismatchProperty |
|
452 | 452 | |
453 | 453 | $db->begin(); |
454 | 454 | |
@@ -573,7 +573,7 @@ discard block |
||
573 | 573 | } |
574 | 574 | } |
575 | 575 | |
576 | - $ret = $object->update($user); // This may include call to setPassword if password has changed |
|
576 | + $ret = $object->update($user); // This may include call to setPassword if password has changed |
|
577 | 577 | if ($ret < 0) { |
578 | 578 | $error++; |
579 | 579 | if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | $object->fetch($id); |
688 | 688 | |
689 | 689 | if (GETPOST("password", "password")) { // If pass is empty, we do not change it. |
690 | - $object->oldcopy = clone $object; // @phan-suppress-current-line PhanTypeMismatchProperty |
|
690 | + $object->oldcopy = clone $object; // @phan-suppress-current-line PhanTypeMismatchProperty |
|
691 | 691 | |
692 | 692 | $ret = $object->setPassword($user, GETPOST("password", "password")); |
693 | 693 | if (is_int($ret) && $ret < 0) { |
@@ -704,7 +704,7 @@ discard block |
||
704 | 704 | ) { |
705 | 705 | $object->fetch($id); |
706 | 706 | |
707 | - $newpassword = $object->setPassword($user, ''); // This will generate a new password |
|
707 | + $newpassword = $object->setPassword($user, ''); // This will generate a new password |
|
708 | 708 | if (is_int($newpassword) && $newpassword < 0) { |
709 | 709 | // Echec |
710 | 710 | setEventMessages($langs->trans("ErrorFailedToSetNewPassword"), null, 'errors'); |
@@ -832,7 +832,7 @@ discard block |
||
832 | 832 | $action = ""; |
833 | 833 | |
834 | 834 | $mesg = $langs->trans("ErrorProductAlreadyExists", $clone->ref); |
835 | - $mesg .= ' <a href="' . $_SERVER["PHP_SELF"] . '?ref=' . $clone->ref . '">' . $langs->trans("ShowCardHere") . '</a>.'; |
|
835 | + $mesg .= ' <a href="'.$_SERVER["PHP_SELF"].'?ref='.$clone->ref.'">'.$langs->trans("ShowCardHere").'</a>.'; |
|
836 | 836 | setEventMessages($mesg, null, 'errors'); |
837 | 837 | } else { |
838 | 838 | setEventMessages(empty($clone->error) ? '' : $langs->trans($clone->error), $clone->errors, 'errors'); |
@@ -846,7 +846,7 @@ discard block |
||
846 | 846 | } else { |
847 | 847 | $db->commit(); |
848 | 848 | $db->close(); |
849 | - header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id); |
|
849 | + header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); |
|
850 | 850 | exit; |
851 | 851 | } |
852 | 852 | } else { |
@@ -1550,7 +1550,7 @@ discard block |
||
1550 | 1550 | $ldap = new Ldap(); |
1551 | 1551 | $result = $ldap->connectBind(); |
1552 | 1552 | if ($result > 0) { |
1553 | - $userSearchFilter = '(' . getDolGlobalString('LDAP_FILTER_CONNECTION').'('.$ldap->getUserIdentifier().'='.$object->login.'))'; |
|
1553 | + $userSearchFilter = '('.getDolGlobalString('LDAP_FILTER_CONNECTION').'('.$ldap->getUserIdentifier().'='.$object->login.'))'; |
|
1554 | 1554 | $entries = $ldap->fetch($object->login, $userSearchFilter); |
1555 | 1555 | if (!$entries) { |
1556 | 1556 | setEventMessages($ldap->error, $ldap->errors, 'errors'); |
@@ -2070,7 +2070,7 @@ discard block |
||
2070 | 2070 | print '<td>'; |
2071 | 2071 | if (!empty($object->api_key)) { |
2072 | 2072 | print '<span class="opacitymedium">'; |
2073 | - print showValueWithClipboardCPButton($object->api_key, 1, $langs->transnoentities("Hidden")); // TODO Add an option to also reveal the hash, not only copy paste |
|
2073 | + print showValueWithClipboardCPButton($object->api_key, 1, $langs->transnoentities("Hidden")); // TODO Add an option to also reveal the hash, not only copy paste |
|
2074 | 2074 | print '</span>'; |
2075 | 2075 | } |
2076 | 2076 | if (getDolGlobalString('API_ENABLE_COUNT_CALLS')) { |
@@ -2136,7 +2136,7 @@ discard block |
||
2136 | 2136 | $langs->load("mails"); |
2137 | 2137 | $params['attr']['title'] = $langs->trans('NoEMail'); |
2138 | 2138 | } |
2139 | - print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle', '', $canSendMail, $params); |
|
2139 | + print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=presend&mode=init#formmailbeforetitle', '', $canSendMail, $params); |
|
2140 | 2140 | } |
2141 | 2141 | |
2142 | 2142 | if ($permissiontoedit && (!isModEnabled('multicompany') || !$user->entity || ($object->entity == $conf->entity) || (getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE') && $object->entity == 1))) { |
@@ -2201,13 +2201,13 @@ discard block |
||
2201 | 2201 | if ($user->id != $id && $permissiontodisable && $object->statut == 0 && |
2202 | 2202 | ((!isModEnabled('multicompany') && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || (getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE') && $object->entity == 1))) { |
2203 | 2203 | unset($params['attr']['title']); |
2204 | - print dolGetButtonAction($langs->trans('Reactivate'), '', 'default', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=enable&token='.newToken(), '', true, $params); |
|
2204 | + print dolGetButtonAction($langs->trans('Reactivate'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=enable&token='.newToken(), '', true, $params); |
|
2205 | 2205 | } |
2206 | 2206 | // Disable user |
2207 | 2207 | if ($user->id != $id && $permissiontodisable && $object->statut == 1 && |
2208 | 2208 | ((!isModEnabled('multicompany') && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || (getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE') && $object->entity == 1))) { |
2209 | 2209 | unset($params['attr']['title']); |
2210 | - print dolGetButtonAction($langs->trans('DisableUser'), '', 'default', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=disable&token='.newToken(), '', true, $params); |
|
2210 | + print dolGetButtonAction($langs->trans('DisableUser'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=disable&token='.newToken(), '', true, $params); |
|
2211 | 2211 | } else { |
2212 | 2212 | if ($user->id == $id) { |
2213 | 2213 | $params['attr']['title'] = $langs->trans('CantDisableYourself'); |