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 '
'; + print ''; + print ''; + + print ''; + print '\n"; + print ''; + print '
Supprimer cet utilisateur
Etes-vous sur de vouloir supprimer cet utilisateur ?'; + $htmls = new Form($db); + + $htmls->selectyesno("confirm","no"); + + print "
'; + print "
\n"; + } + print ''; print ''; print ''; - print ''; - print ''; - + print ''; + + print ''; + print ''; + print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; print ''; @@ -217,25 +304,41 @@ else if ($user->admin) { - print ''; + print ''; } else { - print ''; + print ''; } - - print ''; + print ''; if ($user->id == $id or $user->admin) { - print ''; + print ''; } else { - print ''; + print ''; + } + + if ($user->admin) + { + print ''; + } + else + { + print ''; + } + + + if ($user->admin && $user->id <> $id) + { + print ''; + } + else + { + print ''; } - print ''; - print '
Nom'.$fuser->nom.'Prénom'.$fuser->prenom.'
Droits
Prénom'.$fuser->prenom.''; + /* + * 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 "'; + $i++; + } + } + print '
".$obj->libelle . '
'; + + print '
Login'.$fuser->login.'Email'.$fuser->login.'
Email'.$fuser->email.'
Webcal Login'.$fuser->webcal_login.' Administrateur'.$fuser->webcal_login.' 
Administrateur'.$yn[$fuser->admin].'
Module Compta'.$yn[$fuser->compta].' Module Commercial'.$yn[$fuser->compta].' 
Module Commercial'.$yn[$fuser->comm].'
Id Société'.$fuser->societe_id.'  '.$fuser->societe_id.' 
'; + if ($fuser->contact_id) + { + print 'Fiche contact'; + } + else + { + print " "; + } + print ' 
Note[Editer][Editer]----[Nouveau mot de passe][Nouveau mot de passe]--[Permissions]-[Supprimer]--

'; @@ -245,22 +348,19 @@ else /* */ /* ************************************************************************** */ - if ($action == 'edit' && $user->admin) + if ($action == 'edit' && $user->admin && !$fuser->societe_id) { print '
Edition de l\'utilisateur

'; print '
'; print ''; print ''; - print ''; - print ''; - print ''; print ''; - + print ''; print ''; - + print ''; print ''; @@ -290,11 +390,35 @@ else print $fuser->note; print ""; - print ''; + print ''; print ''; print '
Id'.$fuser->id.'
Nom
Prénom
Login
'; } - + + if ($request == 'perms') + { + /* + * Droits + */ + print ''; + $sql = "SELECT r.id, r.libelle FROM llx_rights_def as r ORDER BY r.id ASC"; + + if ($db->query($sql)) + { + $num = $db->num_rows(); + $i = 0; + while ($i < $num) + { + $obj = $db->fetch_object($i); + print ''; + print ''; + $i++; + } + } + print '
Ajouter'; + print $obj->libelle . 'Supprimer
'; + } + } }