diff --git a/htdocs/user/addon.php b/htdocs/user/addon.php index 505afe27411..60b8d61c4e8 100644 --- a/htdocs/user/addon.php +++ b/htdocs/user/addon.php @@ -75,24 +75,24 @@ if ($_GET["id"]) if ($user->admin) { - $head[$h][0] = DOL_URL_ROOT.'/user/perms.php?id='.$fuser->id; - $head[$h][1] = $langs->trans("Permissions"); - $h++; + $head[$h][0] = DOL_URL_ROOT.'/user/perms.php?id='.$fuser->id; + $head[$h][1] = $langs->trans("UserRights"); + $h++; } if ($conf->bookmark4u->enabled) { - $head[$h][0] = DOL_URL_ROOT.'/user/addon.php?id='.$fuser->id; - $head[$h][1] = $langs->trans("Bookmark4u"); - $hselected=$h; - $h++; + $head[$h][0] = DOL_URL_ROOT.'/user/addon.php?id='.$fuser->id; + $head[$h][1] = $langs->trans("Bookmark4u"); + $hselected=$h; + $h++; } if ($conf->clicktodial->enabled) { - $head[$h][0] = DOL_URL_ROOT.'/user/clicktodial.php?id='.$fuser->id; - $head[$h][1] = $langs->trans("ClickToDial"); - $h++; + $head[$h][0] = DOL_URL_ROOT.'/user/clicktodial.php?id='.$fuser->id; + $head[$h][1] = $langs->trans("ClickToDial"); + $h++; } dolibarr_fiche_head($head, $hselected, $langs->trans("User").": ".$fuser->fullname); diff --git a/htdocs/user/clicktodial.php b/htdocs/user/clicktodial.php index ca097cfe07b..c94ca7711cb 100644 --- a/htdocs/user/clicktodial.php +++ b/htdocs/user/clicktodial.php @@ -78,24 +78,24 @@ if ($_GET["id"]) if ($user->admin) { - $head[$h][0] = DOL_URL_ROOT.'/user/fiche.php?action=perms&id='.$fuser->id; - $head[$h][1] = $langs->trans("Permissions"); - $h++; + $head[$h][0] = DOL_URL_ROOT.'/user/fiche.php?action=perms&id='.$fuser->id; + $head[$h][1] = $langs->trans("UserRights"); + $h++; } if ($conf->bookmark4u->enabled) { - $head[$h][0] = DOL_URL_ROOT.'/user/addon.php?id='.$fuser->id; - $head[$h][1] = $langs->trans("Bookmark4u"); - $h++; + $head[$h][0] = DOL_URL_ROOT.'/user/addon.php?id='.$fuser->id; + $head[$h][1] = $langs->trans("Bookmark4u"); + $h++; } if ($conf->clicktodial->enabled) { - $head[$h][0] = DOL_URL_ROOT.'/user/clicktodial.php?id='.$fuser->id; - $head[$h][1] = $langs->trans("ClickToDial"); - $hselected=$h; - $h++; + $head[$h][0] = DOL_URL_ROOT.'/user/clicktodial.php?id='.$fuser->id; + $head[$h][1] = $langs->trans("ClickToDial"); + $hselected=$h; + $h++; } dolibarr_fiche_head($head, $hselected, $langs->trans("User")." : ".$fuser->fullname); diff --git a/htdocs/user/fiche.php b/htdocs/user/fiche.php index 26cd170132b..4282d3bb15e 100644 --- a/htdocs/user/fiche.php +++ b/htdocs/user/fiche.php @@ -53,6 +53,17 @@ if ($_GET["subaction"] == 'delrights' && $user->admin) $edituser->delrights($_GET["rights"]); } +if ($_POST["action"] == 'confirm_disable' && $_POST["confirm"] == "yes") +{ + if ($_GET["id"] <> $user->id) + { + $edituser = new User($db, $_GET["id"]); + $edituser->fetch($_GET["id"]); + $edituser->disable(); + Header("Location: index.php"); + } +} + if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == "yes") { if ($_GET["id"] <> $user->id) @@ -209,21 +220,21 @@ if ($action == 'create') print ''.$langs->trans("Firstname").''; print ''; - print "".''.$langs->trans("Login").''; + print ''.$langs->trans("Login").''; print ''; - print "".''.$langs->trans("Password").''; + print ''.$langs->trans("Password").''; print ''; - print "".''.$langs->trans("EMail").''; + print ''.$langs->trans("EMail").''; print ''; - print "".''.$langs->trans("Administrator").''; + print ''.$langs->trans("Administrator").''; print ''; $form->selectyesnonum('admin',0); print "\n"; - print "".''.$langs->trans("Note").''; + print ''.$langs->trans("Note").''; print "\n"; @@ -264,7 +275,7 @@ else $h++; $head[$h][0] = DOL_URL_ROOT.'/user/perms.php?id='.$fuser->id; - $head[$h][1] = $langs->trans("Permissions"); + $head[$h][1] = $langs->trans("UserRights"); $h++; if ($conf->bookmark4u->enabled) @@ -277,13 +288,22 @@ else dolibarr_fiche_head($head, $hselected, $langs->trans("User").": ".$fuser->fullname); + /* + * Confirmation désactivation + */ + if ($action == 'disable') + { + $html = new Form($db); + $html->form_confirm("fiche.php?id=$fuser->id",$langs->trans("DisableAUser"),$langs->trans("ConfirmDisableUser",$fuser->login),"confirm_disable"); + } + /* * Confirmation suppression */ if ($action == 'delete') { $html = new Form($db); - $html->form_confirm("fiche.php?id=$fuser->id",$langs->trans("DisableAUser"),$langs->trans("ConfirmDisableUser",$fuser->login),"confirm_delete"); + $html->form_confirm("fiche.php?id=$fuser->id",$langs->trans("DeleteAUser"),$langs->trans("ConfirmDeleteUser",$fuser->login),"confirm_delete"); } if ($_GET["action"] != 'edit') @@ -390,7 +410,12 @@ else if ($user->id <> $_GET["id"] && $user->admin) { - print ''.$langs->trans("DisableUser").''; + print ''.$langs->trans("DisableUser").''; + } + + if ($user->id <> $_GET["id"] && $user->admin) + { + print ''.$langs->trans("DeleteUser").''; } print "\n"; diff --git a/htdocs/user/group/fiche.php b/htdocs/user/group/fiche.php index 2a5119e4bae..7fc95139df6 100644 --- a/htdocs/user/group/fiche.php +++ b/htdocs/user/group/fiche.php @@ -35,61 +35,72 @@ $action=isset($_GET["action"])?$_GET["action"]:$_POST["action"]; /** - * Action ajout + * Action suppression groupe + */ +if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == "yes") +{ + $editgroup = new Usergroup($db, $_GET["id"]); + $editgroup->fetch($_GET["id"]); + $editgroup->delete(); + Header("Location: index.php"); +} + +/** + * Action ajout groupe */ if ($_POST["action"] == 'add' && $user->admin) { - $message=""; - if (! $_POST["nom"]) { - $message='
'.$langs->trans("NameNotDefined").'
'; - $action="create"; // Go back to create page - } + $message=""; + if (! $_POST["nom"]) { + $message='
'.$langs->trans("NameNotDefined").'
'; + $action="create"; // Go back to create page + } - if (! $message) { - $editgroup = new UserGroup($db,0); - - $editgroup->nom = trim($_POST["nom"]); - $editgroup->note = trim($_POST["note"]); - - $db->begin(); + if (! $message) { + $editgroup = new UserGroup($db,0); - $id = $editgroup->create(); - - if ($id > 0) - { - $db->commit(); - - Header("Location: fiche.php?id=".$editgroup->id); - } - else - { - $db->rollback(); + $editgroup->nom = trim($_POST["nom"]); + $editgroup->note = trim($_POST["note"]); - $message='
'.$langs->trans("ErrorGroupAlreadyExists",$editgroup->nom).'
'; - $action="create"; // Go back to create page - } - } + $db->begin(); + + $id = $editgroup->create(); + + if ($id > 0) + { + $db->commit(); + + Header("Location: fiche.php?id=".$editgroup->id); + } + else + { + $db->rollback(); + + $message='
'.$langs->trans("ErrorGroupAlreadyExists",$editgroup->nom).'
'; + $action="create"; // Go back to create page + } + } } if ($_POST["action"] == 'adduser' && $user->admin) { - if ($_POST["user"]) + if ($_POST["user"]) { - $edituser = new User($db, $_POST["user"]); - $edituser->SetInGroup($_GET["id"]); + $edituser = new User($db, $_POST["user"]); + $edituser->SetInGroup($_GET["id"]); - Header("Location: fiche.php?id=".$_GET["id"]); + Header("Location: fiche.php?id=".$_GET["id"]); } } if ($_GET["action"] == 'removeuser' && $user->admin) { - if ($_GET["user"]) + if ($_GET["user"]) { - $edituser = new User($db, $_GET["user"]); - $edituser->RemoveFromGroup($_GET["id"]); + $edituser = new User($db, $_GET["user"]); + $edituser->RemoveFromGroup($_GET["id"]); - Header("Location: fiche.php?id=".$_GET["id"]); + Header("Location: fiche.php?id=".$_GET["id"]); } } @@ -104,26 +115,26 @@ llxHeader(); if ($action == 'create') { - print_titre($langs->trans("NewGroup")); - print "
"; + print_titre($langs->trans("NewGroup")); + print "
"; - if ($message) { print $message."
"; } + if ($message) { print $message."
"; } - print '
'; - print ''; + print ''; + print ''; - print ''; + print '
'; - print "".''; - print ''; + print "".''; + print ''; - print "".'\n"; + print "".'\n"; - print "".''; - print ""; - print "
'.$langs->trans("Name").'
'.$langs->trans("Name").'
'.$langs->trans("Note").''; - print "
'.$langs->trans("Note").''; + print "
\n"; + print "".''; + print ""; + print "\n"; } @@ -134,147 +145,180 @@ if ($action == 'create') /* ************************************************************************** */ else { - if ($_GET["id"]) + if ($_GET["id"]) { - $group = new UserGroup($db); - $group->fetch($_GET["id"]); + $group = new UserGroup($db); + $group->fetch($_GET["id"]); - /* - * Affichage onglets - */ - - $h = 0; - $head[$h][0] = DOL_URL_ROOT.'/user/group/fiche.php?id='.$group->id; - $head[$h][1] = $langs->trans("GroupCard"); - $hselected=$h; - $h++; - - dolibarr_fiche_head($head, $hselected, $langs->trans("Group").": ".$group->nom); + /* + * Affichage onglets + */ - /* - * Confirmation suppression - */ - if ($action == 'delete') + $h = 0; + + $head[$h][0] = DOL_URL_ROOT.'/user/group/fiche.php?id='.$group->id; + $head[$h][1] = $langs->trans("GroupCard"); + $hselected=$h; + $h++; + + $head[$h][0] = DOL_URL_ROOT.'/user/group/perms.php?id='.$group->id; + $head[$h][1] = $langs->trans("GroupRights"); + $h++; + + dolibarr_fiche_head($head, $hselected, $langs->trans("Group").": ".$group->nom); + + + /* + * Confirmation suppression + */ + if ($action == 'delete') { - $html = new Form($db); - $html->form_confirm("fiche.php?id=$fuser->id",$langs->trans("DisableAGroup"),$langs->trans("ConfirmDisableGroup",$fuser->login),"confirm_delete"); + $html = new Form($db); + $html->form_confirm("fiche.php?id=$group->id",$langs->trans("DeleteAGroup"),$langs->trans("ConfirmDeleteGroup",$group->name),"confirm_delete"); } - /* - * Fiche en mode visu - */ - - print ''; - print ''; - print ''; - print "\n"; - print ''; - print ''; - print "\n"; - print "
'.$langs->trans("Name").''.$group->nom.'
'.$langs->trans("Note").''.nl2br($group->note).' 
\n"; - print "
\n"; + /* + * Fiche en mode visu + */ - $uss = array(); - - // On sélectionne les users qui ne sont pas déjà dans le groupe - $sql = "SELECT u.rowid, u.name, u.firstname, u.code "; - $sql .= " FROM ".MAIN_DB_PREFIX."user as u "; -# $sql .= " LEFT JOIN llx_usergroup_user ug ON u.rowid = ug.fk_user"; -# $sql .= " WHERE ug.fk_usergroup IS NULL"; - $sql .= " ORDER BY u.name"; - - $result = $db->query($sql); - if ($result) - { - $num = $db->num_rows(); - $i = 0; - - while ($i < $num) - { - $obj = $db->fetch_object(); + print ''; + print ''; + print ''; + print "\n"; + print ''; + print ''; + print "\n"; + print "
'.$langs->trans("Name").''.$group->nom.'
'.$langs->trans("Note").''.nl2br($group->note).' 
\n"; + print "
\n"; - $uss[$obj->rowid] = ucfirst(stripslashes($obj->firstname)) . " ".ucfirst(stripslashes($obj->name)); - $i++; - } - } - else { - dolibarr_print_error($db); - } - - if ($user->admin) - { - $form = new Form($db); - print '
'."\n"; - print ''; - print ''."\n"; -// print ''."\n"; - print ''."\n"; - print ''."\n"; - print '
'.$langs->trans("NonAffectedUsers").'
'.$langs->trans("Users").''; - print $form->select_array("user",$uss); - print ''; - print ''; - print '
'."\n"; - } - /* - * Membres du groupe - * - */ - $sql = "SELECT u.rowid, u.name, u.firstname, u.code "; - $sql .= " FROM ".MAIN_DB_PREFIX."user as u"; - $sql .= ",".MAIN_DB_PREFIX."usergroup_user as ug"; - $sql .= " WHERE ug.fk_user = u.rowid"; - $sql .= " AND ug.fk_usergroup = ".$group->id; - $sql .= " ORDER BY u.name"; - - $result = $db->query($sql); - if ($result) - { - $num = $db->num_rows($result); - $i = 0; - - print "
"; - - print ''; - print ''; - print ''; - print ''; - print ''; - print "\n"; - $var=True; - while ($i < $num) - { - $obj = $db->fetch_object($result); - $var=!$var; - - print ""; - print ''; - print ''; - print '\n"; - $i++; - } - print "
'.$langs->trans("Lastname").''.$langs->trans("Firstname").''.$langs->trans("Code").' 
'; - print ''.img_object($langs->trans("ShowUser"),"user").' '; - print ''.ucfirst(stripslashes($obj->name)).''; - print ''.ucfirst(stripslashes($obj->firstname)).''.$obj->code.''; - if ($user->admin) - { - - print ''; - print img_delete($langs->trans("RemoveFromGroup")); - } - else - { - print "-"; - } - print "
"; - print "
"; - $db->free($result); - } + print ''; + + if ($message) { print $message; } + + /* + * Barre d'actions + * + */ + print '
'; + + if ($user->admin) + { + print ''.$langs->trans("Edit").''; + } + + if ($user->id <> $_GET["id"] && $user->admin) + { + print ''.$langs->trans("DeleteGroup").''; + } + + print "
\n"; + print "
\n"; + + print_titre($langs->trans("ListOfUsersInGroup")); + print "
\n"; + + // On sélectionne les users qui ne sont pas déjà dans le groupe + $uss = array(); + + $sql = "SELECT u.rowid, u.name, u.firstname, u.code "; + $sql .= " FROM ".MAIN_DB_PREFIX."user as u "; + # $sql .= " LEFT JOIN llx_usergroup_user ug ON u.rowid = ug.fk_user"; + # $sql .= " WHERE ug.fk_usergroup IS NULL"; + $sql .= " ORDER BY u.name"; + + $result = $db->query($sql); + if ($result) + { + $num = $db->num_rows(); + $i = 0; + + while ($i < $num) + { + $obj = $db->fetch_object(); + + $uss[$obj->rowid] = ucfirst(stripslashes($obj->firstname)) . " ".ucfirst(stripslashes($obj->name)); + $i++; + } + } + else { + dolibarr_print_error($db); + } + + if ($user->admin) + { + $form = new Form($db); + print '
'."\n"; + print ''; + print ''."\n"; + // print ''."\n"; + print ''."\n"; + print ''."\n"; + print '
'.$langs->trans("NonAffectedUsers").'
'.$langs->trans("Users").''; + print $form->select_array("user",$uss); + print '   '; + print ''; + print '
'."\n"; + } + + /* + * Membres du groupe + */ + $sql = "SELECT u.rowid, u.login, u.name, u.firstname, u.code "; + $sql .= " FROM ".MAIN_DB_PREFIX."user as u"; + $sql .= ",".MAIN_DB_PREFIX."usergroup_user as ug"; + $sql .= " WHERE ug.fk_user = u.rowid"; + $sql .= " AND ug.fk_usergroup = ".$group->id; + $sql .= " ORDER BY u.name"; + + $result = $db->query($sql); + if ($result) + { + $num = $db->num_rows($result); + $i = 0; + + print '
'; + + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print "\n"; + $var=True; + while ($i < $num) + { + $obj = $db->fetch_object($result); + $var=!$var; + + print ""; + print ''; + print ''; + print ''; + print '\n"; + $i++; + } + print "
'.$langs->trans("Login").''.$langs->trans("Lastname").''.$langs->trans("Firstname").''.$langs->trans("Code").' 
'; + print ''.img_object($langs->trans("ShowUser"),"user").' '.$obj->login.''; + print ''.ucfirst(stripslashes($obj->name)).''.ucfirst(stripslashes($obj->firstname)).''.$obj->code.''; + + if ($user->admin) + { + + print ''; + print img_delete($langs->trans("RemoveFromGroup")); + } + else + { + print "-"; + } + print "
"; + print "
"; + $db->free($result); + } - print ''; } } diff --git a/htdocs/user/group/perms.php b/htdocs/user/group/perms.php new file mode 100644 index 00000000000..eab5dfcbccd --- /dev/null +++ b/htdocs/user/group/perms.php @@ -0,0 +1,185 @@ + + * Copyright (C) 2002-2003 Jean-Louis Bergamo + * Copyright (C) 2004-2005 Laurent Destailleur + * Copyright (C) 2004 Eric Seigne + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + */ + +/** \file htdocs/user/group/perms.php + \brief Onglet user et permissions de la fiche utilisateur + \version $Revision$ +*/ + + +require("./pre.inc.php"); + +$langs->load("users"); + + +$form = new Form($db); + +$action=isset($_GET["action"])?$_GET["action"]:$_POST["action"]; + + +/** + * Actions + */ +if ($_GET["subaction"] == 'addrights' && $user->admin) +{ + $editgroup = new Usergroup($db,$_GET["id"]); + $editgroup->addrights($_GET["rights"]); +} + +if ($_GET["subaction"] == 'delrights' && $user->admin) +{ + $editgroup = new Usergroup($db,$_GET["id"]); + $editgroup->delrights($_GET["rights"]); +} + + +llxHeader('',$langs->trans("Permissions")); + + +/* ************************************************************************** */ +/* */ +/* Visu et edition */ +/* */ +/* ************************************************************************** */ + +if ($_GET["id"]) +{ + $fgroup = new Usergroup($db, $_GET["id"]); + $fgroup->fetch($_GET["id"]); + $fgroup->getrights($_GET["id"]); + + /* + * Affichage onglets + */ + + $h = 0; + + $head[$h][0] = DOL_URL_ROOT.'/user/group/fiche.php?id='.$fgroup->id; + $head[$h][1] = $langs->trans("GroupCard"); + $h++; + + $head[$h][0] = DOL_URL_ROOT.'/user/group/perms.php?id='.$fgroup->id; + $head[$h][1] = $langs->trans("GroupRights"); + $hselected=$h; + $h++; + + + dolibarr_fiche_head($head, $hselected, $langs->trans("Group").": ".$fgroup->nom); + + // Lecture des droits du groupe + $sql = "SELECT r.id, r.libelle, r.module "; + $sql .= " FROM ".MAIN_DB_PREFIX."rights_def as r"; + $sql .= ", ".MAIN_DB_PREFIX."usergroup_rights as ugr"; + $sql .= " WHERE ugr.fk_id = r.id AND ugr.fk_usergroup = ".$fgroup->id; + + $result=$db->query($sql); + + $perms = array(); + + if ($result) + { + $num = $db->num_rows(); + $i = 0; + while ($i < $num) + { + $obj = $db->fetch_object($i); + + array_push($perms,$obj->id); + + $i++; + } + $db->free(); + } + else + { + dolibarr_print_error($db); + } + + + /* + * Ecran ajout/suppression permission + */ + + + print ''; + print ''; + + $sql = "SELECT r.id, r.libelle, r.module FROM ".MAIN_DB_PREFIX."rights_def as r ORDER BY r.module, r.id ASC"; + + if ($db->query($sql)) + { + $num = $db->num_rows(); + $i = 0; + $var = True; + while ($i < $num) + { + $obj = $db->fetch_object($i); + if ($oldmod <> $obj->module) + { + $oldmod = $obj->module; + $var = !$var; + } + print ''; + + if ( $user->admin ) + { + if (in_array($obj->id, $perms)) + { + print ''; + print ''; + } + else + { + print ''; + print ''; + } + + print ''; + print ''; + } + else + { + if (in_array($obj->id, $perms)) + { + print ''; + print ''; + print ''; + } + } + + + $i++; + } + } + print '
  '.$langs->trans("Permissions").''.$langs->trans("Module").'
 '; + print ''.img_edit_remove().''; + print ''; + print ''.img_edit_add().''; + print ' '.$obj->libelle . ''.$obj->module . '
  '.$obj->libelle . ''.$obj->module . '
'; +} + +$db->close(); + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?> diff --git a/htdocs/user/index.php b/htdocs/user/index.php index f28dfc3a925..a0cdc37c6c9 100644 --- a/htdocs/user/index.php +++ b/htdocs/user/index.php @@ -40,7 +40,7 @@ if ($page < 0) $page = 0; $limit = $conf->liste_limit; $offset = $limit * $page ; -if (! $sortfield) $sortfield="u.name"; +if (! $sortfield) $sortfield="u.login"; if (! $sortorder) $sortorder="ASC"; @@ -66,9 +66,9 @@ if ($result) print ""; print ''; + print_liste_field_titre($langs->trans("Login"),"index.php","u.login","","","",$sortfield); print_liste_field_titre($langs->trans("Lastname"),"index.php","u.name","","","",$sortfield); print_liste_field_titre($langs->trans("Firstname"),"index.php","u.firstname","","","",$sortfield); - print_liste_field_titre($langs->trans("Login"),"index.php","u.login","","","",$sortfield); print_liste_field_titre($langs->trans("Code"),"index.php","u.code","","","",$sortfield); print_liste_field_titre($langs->trans("DateCreation"),"index.php","u.datec","","","",$sortfield); print "\n"; @@ -79,8 +79,6 @@ if ($result) $var=!$var; print ""; - print ''; - print ''; if ($obj->login) { print ''; @@ -89,6 +87,8 @@ if ($result) { print ''; } + print ''; + print ''; print ''; print ''; print "\n"; diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php index d188321cb22..a9d714c2bff 100644 --- a/htdocs/user/perms.php +++ b/htdocs/user/perms.php @@ -22,7 +22,7 @@ * $Source$ */ -/** \file htdocs/user/fiche.php +/** \file htdocs/user/perms.php \brief Onglet user et permissions de la fiche utilisateur \version $Revision$ */ @@ -53,79 +53,9 @@ if ($_GET["subaction"] == 'delrights' && $user->admin) $edituser->delrights($_GET["rights"]); } -if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == "yes") -{ - if ($_GET["id"] <> $user->id && $user->admin) - { - $edituser = new User($db, $_GET["id"]); - $edituser->fetch($_GET["id"]); - $edituser->delete(); - Header("Location: index.php"); - } -} - -/** - * Action ajout user - */ -if ($_POST["action"] == 'add' && $user->admin) -{ - $message=""; - if (! $_POST["nom"]) - { - $message='
'.$langs->trans("NameNotDefined").'
'; - $action="create"; // Go back to create page - } - if (! $_POST["login"]) - { - $message='
'.$langs->trans("LoginNotDefined").'
'; - $action="create"; // Go back to create page - } - if (! $message) - { - $edituser = new User($db,0); - - $edituser->nom = trim($_POST["nom"]); - $edituser->note = trim($_POST["note"]); - $edituser->prenom = trim($_POST["prenom"]); - $edituser->login = trim($_POST["login"]); - $edituser->email = trim($_POST["email"]); - $edituser->admin = trim($_POST["admin"]); - $edituser->webcal_login = trim($_POST["webcal_login"]); - - $id = $edituser->create(); - - if ($id) - { - if (isset($_POST['password']) && trim($_POST['password'])) - { - $edituser->password(trim($_POST['password']),$conf->password_encrypted); - } - - Header("Location: fiche.php?id=$id"); - } - else - { - $message='
'.$langs->trans("ErrorLoginAlreadyExists",$edituser->login).'
'; - $action="create"; // Go back to create page - } - } -} - -if ($_GET["action"] == 'password' && $user->admin) -{ - $edituser = new User($db, $_GET["id"]); - $edituser->fetch(); - - if ($edituser->password($user,'',$conf->password_encrypted)) - { - $message = '
'.$langs->trans("PasswordChangedAndSentTo",$edituser->email).'
'; - } -} - - -llxHeader('','Fiche Utilisateur'); +llxHeader('',$langs->trans("Permissions")); /* ************************************************************************** */ @@ -151,10 +81,9 @@ if ($_GET["id"]) $h++; $head[$h][0] = DOL_URL_ROOT.'/user/perms.php?id='.$fuser->id; - $head[$h][1] = $langs->trans("Permissions"); + $head[$h][1] = $langs->trans("UserRights"); $hselected=$h; $h++; - if ($conf->bookmark4u->enabled) { @@ -165,7 +94,7 @@ if ($_GET["id"]) dolibarr_fiche_head($head, $hselected, $langs->trans("User").": ".$fuser->fullname); - + // Lecture des droits de l'utilisateur $sql = "SELECT r.id, r.libelle, r.module "; $sql .= " FROM ".MAIN_DB_PREFIX."rights_def as r"; $sql .= ", ".MAIN_DB_PREFIX."user_rights as ur"; @@ -201,7 +130,7 @@ if ($_GET["id"]) print '
'.ucfirst($obj->name).''.ucfirst($obj->firstname).''.img_object($langs->trans("ShowUser"),"user").' '.$obj->login.''.img_object($langs->trans("ShowUser"),"user").' Inactif'.ucfirst($obj->name).''.ucfirst($obj->firstname).''.$obj->code.''.dolibarr_print_date($obj->datec,"%d %b %Y").'
'; - print ''; + print ''; $sql = "SELECT r.id, r.libelle, r.module FROM ".MAIN_DB_PREFIX."rights_def as r ORDER BY r.module, r.id ASC"; @@ -226,9 +155,8 @@ if ($_GET["id"]) { print ''; print ''; - } else { @@ -238,7 +166,6 @@ if ($_GET["id"]) print ''; } - print ''; print ''; }
  '.$langs->trans("AvailableRights").''.$langs->trans("Module").'
  '.$langs->trans("Permissions").''.$langs->trans("Module").'
 '; - print "id."&action=perms&subaction=delrights&rights=".$obj->id."\">".img_edit_remove()."\n"; + print ''.img_edit_remove().''; print ' '.$obj->libelle . ''.$obj->module . '