diff --git a/htdocs/user/fiche.php3 b/htdocs/user/fiche.php3
index 91a5d040daa..bb50c3b2de1 100644
--- a/htdocs/user/fiche.php3
+++ b/htdocs/user/fiche.php3
@@ -22,11 +22,33 @@
require("./pre.inc.php3");
-llxHeader();
-
$db = new Db();
$form = new Form($db);
+if ($subaction == 'addrights' && $user->admin)
+{
+ $edituser = new User($db,$id);
+ $edituser->addrights($rights);
+}
+
+if ($subaction == 'delrights' && $user->admin)
+{
+ $edituser = new User($db,$id);
+ $edituser->delrights($rights);
+}
+
+if ($HTTP_POST_VARS["action"] == 'confirm_delete' && $HTTP_POST_VARS["confirm"] == "yes")
+{
+ if ($id <> $user->id)
+ {
+ $edituser = new User($db, $id);
+ $edituser->fetch($id);
+ $edituser->delete();
+ Header("Location: index.php");
+ }
+}
+
+
if ($HTTP_POST_VARS["action"] == 'add' && $user->admin)
{
$edituser = new User($db,0);
@@ -38,16 +60,24 @@ if ($HTTP_POST_VARS["action"] == 'add' && $user->admin)
$edituser->email = $HTTP_POST_VARS["email"];
$edituser->admin = $HTTP_POST_VARS["admin"];
$edituser->webcal_login = $HTTP_POST_VARS["webcal_login"];
- if (isset($HTTP_POST_VARS["module_compta"]) && $HTTP_POST_VARS["module_compta"] ==1){
- $edituser->compta = 1;
- }else{
- $edituser->compta = 0;
- }
- if (isset($HTTP_POST_VARS["module_comm"]) && $HTTP_POST_VARS["module_comm"] ==1){
- $edituser->comm = 1;
- }else{
- $edituser->comm = 0;
- }
+
+ if (isset($HTTP_POST_VARS["module_compta"]) && $HTTP_POST_VARS["module_compta"] ==1)
+ {
+ $edituser->compta = 1;
+ }
+ else
+ {
+ $edituser->compta = 0;
+ }
+
+ if (isset($HTTP_POST_VARS["module_comm"]) && $HTTP_POST_VARS["module_comm"] ==1)
+ {
+ $edituser->comm = 1;
+ }
+ else
+ {
+ $edituser->comm = 0;
+ }
//$id = $edituser->create($user->id);
$id = $edituser->create();
@@ -109,7 +139,7 @@ if ($action == 'password' && $user->admin)
}
}
-
+llxHeader();
/* ************************************************************************** */
/* */
@@ -179,33 +209,90 @@ else
$fuser = new User($db, $id);
$fuser->fetch();
- print '
Fiche utilisateur
'.$message.'
';
+ print_fiche_titre("Fiche utilisateur",$message);
+
+ if ($request == 'delete')
+ {
+ print '\n";
+ }
+
print '';
print '| Nom | ';
print ''.$fuser->nom.' | ';
- print 'Prénom | ';
- print ''.$fuser->prenom.' |
';
-
+ print 'Droits | ';
+
+ print '| Prénom | ';
+ print ''.$fuser->prenom.' | ';
+ print '';
+ /*
+ * Droits
+ */
+ print '';
+ $sql = "SELECT r.libelle, r.module FROM llx_rights_def as r, llx_user_rights as ur";
+ $sql .= " WHERE ur.fk_id = r.id AND ur.fk_user = ".$fuser->id. " ORDER BY r.id ASC";
+ $var = True;
+ if ($db->query($sql))
+ {
+ $num = $db->num_rows();
+ $i = 0;
+ while ($i < $num)
+ {
+ $obj = $db->fetch_object($i);
+ if ($oldmod <> $obj->module)
+ {
+ $oldmod = $obj->module;
+ $var = !$var;
+ }
+
+ print "| ".$obj->libelle . ' | ';
+ $i++;
+ }
+ }
+ print ' ';
+
+ print ' |
';
print '| Login | ';
- print ''.$fuser->login.' | ';
- print 'Email | ';
+ print ''.$fuser->login.' |
';
+ print '| Email | ';
print ''.$fuser->email.' |
';
print '| Webcal Login | ';
- print ''.$fuser->webcal_login.' | ';
- print 'Administrateur | ';
+ print ''.$fuser->webcal_login.' |
';
+ print '| Administrateur | ';
print ''.$yn[$fuser->admin].' |
';
print '| Module Compta | ';
- print ''.$yn[$fuser->compta].' | ';
- print 'Module Commercial | ';
+ print ''.$yn[$fuser->compta].' |
';
+ print '| Module Commercial | ';
print ''.$yn[$fuser->comm].' |
';
print '| Id Société | ';
- print ''.$fuser->societe_id.' | ';
- print ' | ';
+ print ''.$fuser->societe_id.' |
';
+ print '| ';
+ if ($fuser->contact_id)
+ {
+ print 'Fiche contact';
+ }
+ else
+ {
+ print " ";
+ }
+ print ' | ';
print ' |
';
print '| Note | ';
@@ -217,25 +304,41 @@ else
if ($user->admin)
{
- print '[Editer] | ';
+ print '[Editer] | ';
}
else
{
- print '- | ';
+ print '- | ';
}
-
- print '- | ';
+ print '- | ';
if ($user->id == $id or $user->admin)
{
- print '[Nouveau mot de passe] | ';
+ print '[Nouveau mot de passe] | ';
}
else
{
- print '- | ';
+ print '- | ';
+ }
+
+ if ($user->admin)
+ {
+ print '[Permissions] | ';
+ }
+ else
+ {
+ print '- | ';
+ }
+
+
+ if ($user->admin && $user->id <> $id)
+ {
+ print '[Supprimer] | ';
+ }
+ else
+ {
+ print '- | ';
}
- print '- | ';
-
print '
';
@@ -245,22 +348,19 @@ else
/* */
/* ************************************************************************** */
- if ($action == 'edit' && $user->admin)
+ if ($action == 'edit' && $user->admin && !$fuser->societe_id)
{
print '
Edition de l\'utilisateur
';
print '