feat: dolGetButtonAction
This commit is contained in:
parent
3fb0d307b1
commit
26e23219e6
@ -1843,21 +1843,16 @@ if ($action == 'create' || $action == 'adduserldap') {
|
||||
}
|
||||
|
||||
if ($caneditfield && (empty($conf->multicompany->enabled) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) {
|
||||
$params = array(
|
||||
'attr' => array(
|
||||
'title' => '',
|
||||
'class' => 'classfortooltip'
|
||||
)
|
||||
);
|
||||
if (!empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED)) {
|
||||
$params = array(
|
||||
'attr' => array(
|
||||
'title' => $langs->trans('DisabledInMonoUserMode'),
|
||||
'class' => 'classfortooltip'
|
||||
)
|
||||
);
|
||||
$params['attr']['title'] = $langs->trans('DisabledInMonoUserMode');
|
||||
print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER['PHP_SELF'].'#', '', false, $params);
|
||||
} else {
|
||||
$params = array(
|
||||
'attr' => array(
|
||||
'title' => '',
|
||||
'class' => 'classfortooltip'
|
||||
)
|
||||
);
|
||||
print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=edit', '', true, $params);
|
||||
}
|
||||
} elseif ($caneditpassword && !$object->ldap_sid &&
|
||||
@ -1872,43 +1867,53 @@ if ($action == 'create' || $action == 'adduserldap') {
|
||||
}
|
||||
|
||||
// Si on a un gestionnaire de generation de mot de passe actif
|
||||
$params = array(
|
||||
'attr' => array(
|
||||
'title' => '',
|
||||
'class' => 'classfortooltip'
|
||||
)
|
||||
);
|
||||
if ($conf->global->USER_PASSWORD_GENERATED != 'none') {
|
||||
if ($object->statut == 0) {
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("UserDisabled")).'">'.$langs->trans("ReinitPassword").'</a></div>';
|
||||
$params['attr']['title'] = $langs->trans('UserDisabled');
|
||||
print dolGetButtonAction($langs->trans('ReinitPassword'), '', 'default', $_SERVER['PHP_SELF'].'#', '', false, $params);
|
||||
} elseif (($user->id != $id && $caneditpassword) && $object->login && !$object->ldap_sid &&
|
||||
((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=password">'.$langs->trans("ReinitPassword").'</a></div>';
|
||||
print dolGetButtonAction($langs->trans('ReinitPassword'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=password', '', true, $params);
|
||||
}
|
||||
|
||||
if ($object->statut == 0) {
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("UserDisabled")).'">'.$langs->trans("SendNewPassword").'</a></div>';
|
||||
$params['attr']['title'] = $langs->trans('UserDisabled');
|
||||
print dolGetButtonAction($langs->trans('SendNewPassword'), '', 'default', $_SERVER['PHP_SELF'].'#', '', false, $params);
|
||||
} elseif (($user->id != $id && $caneditpassword) && $object->login && !$object->ldap_sid &&
|
||||
((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) {
|
||||
if ($object->email) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=passwordsend">'.$langs->trans("SendNewPassword").'</a></div>';
|
||||
print dolGetButtonAction($langs->trans('SendNewPassword'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=passwordsend', '', true, $params);
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NoEMail")).'">'.$langs->trans("SendNewPassword").'</a></div>';
|
||||
$params['attr']['title'] = $langs->trans('NoEMail');
|
||||
print dolGetButtonAction($langs->trans('SendNewPassword'), '', 'default', $_SERVER['PHP_SELF'].'#', '', false, $params);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Enable user
|
||||
$params = array(
|
||||
'attr' => array(
|
||||
'title' => '',
|
||||
'class' => 'classfortooltip'
|
||||
)
|
||||
);
|
||||
if ($user->id <> $id && $candisableuser && $object->statut == 0 &&
|
||||
((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) {
|
||||
print dolGetButtonAction($langs->trans('Reactivate'), '', 'default', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=enable&token='.newToken().$langs->trans("Reactivate"), '');
|
||||
print dolGetButtonAction($langs->trans('Reactivate'), '', 'default', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=enable&token='.newToken().$langs->trans("Reactivate"), '', true, $params);
|
||||
}
|
||||
// Disable user
|
||||
if ($user->id <> $id && $candisableuser && $object->statut == 1 &&
|
||||
((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) {
|
||||
print dolGetButtonAction($langs->trans('DisableUser'), '', 'default', $_SERVER['PHP_SELF'] . '?action=disable&id=' . $object->id . '&token='.newToken().$langs->trans("DisableUser"), '');
|
||||
print dolGetButtonAction($langs->trans('DisableUser'), '', 'default', $_SERVER['PHP_SELF'] . '?action=disable&id=' . $object->id . '&token='.newToken().$langs->trans("DisableUser"), '', true, $params);
|
||||
} else {
|
||||
if ($user->id == $id) {
|
||||
$params = array(
|
||||
'attr' => array(
|
||||
'title' => $langs->trans('CantDisableYourself'),
|
||||
'class' => 'classfortooltip'
|
||||
)
|
||||
);
|
||||
$params['attr']['title'] = $langs->trans('CantDisableYourself');
|
||||
print dolGetButtonAction($langs->trans('DisableUser'), '', 'default', $_SERVER['PHP_SELF'].'#', '', false, $params);
|
||||
}
|
||||
}
|
||||
@ -1916,15 +1921,10 @@ if ($action == 'create' || $action == 'adduserldap') {
|
||||
if ($user->id <> $id && $candisableuser &&
|
||||
((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) {
|
||||
if ($user->admin || !$object->admin) { // If user edited is admin, delete is possible on for an admin
|
||||
print dolGetButtonAction($langs->trans('DeleteUser'), '', 'default', $_SERVER['PHP_SELF'].'?action=delete&token='.newToken().'&id='.$object->id, '');
|
||||
print dolGetButtonAction($langs->trans('DeleteUser'), '', 'default', $_SERVER['PHP_SELF'].'?action=delete&token='.newToken().'&id='.$object->id, '', true, $params);
|
||||
} else {
|
||||
$params = array(
|
||||
'attr' => array(
|
||||
'title' => $langs->trans('MustBeAdminToDeleteOtherAdmin'),
|
||||
'class' => 'classfortooltip'
|
||||
)
|
||||
);
|
||||
print dolGetButtonAction($langs->trans('DeleteUser'), '', 'default', $_SERVER['PHP_SELF'].'?action=delete&token='.newToken().'&id='.$object->id, '', false);
|
||||
$params['attr']['title'] = $langs->trans('MustBeAdminToDeleteOtherAdmin');
|
||||
print dolGetButtonAction($langs->trans('DeleteUser'), '', 'default', $_SERVER['PHP_SELF'].'?action=delete&token='.newToken().'&id='.$object->id, '', false, $params);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user