2004-10-20 23:06:45 +02:00
|
|
|
|
<?php
|
2004-02-13 18:36:27 +01:00
|
|
|
|
/* Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
2004-06-09 12:39:40 +02:00
|
|
|
|
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
|
2005-01-02 16:27:37 +01:00
|
|
|
|
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
2004-12-22 21:50:38 +01:00
|
|
|
|
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
2002-05-06 21:10:48 +02:00
|
|
|
|
*
|
|
|
|
|
|
* 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.
|
|
|
|
|
|
*
|
2002-12-13 17:51:03 +01:00
|
|
|
|
* $Id$
|
|
|
|
|
|
* $Source$
|
2002-05-06 21:10:48 +02:00
|
|
|
|
*/
|
|
|
|
|
|
|
2005-01-16 21:21:58 +01:00
|
|
|
|
/** \file htdocs/user/fiche.php
|
|
|
|
|
|
\brief Onglet user et permissions de la fiche utilisateur
|
|
|
|
|
|
\version $Revision$
|
2004-10-10 17:51:19 +02:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
2003-09-11 17:26:39 +02:00
|
|
|
|
require("./pre.inc.php");
|
2002-05-06 21:10:48 +02:00
|
|
|
|
|
2004-07-31 17:27:37 +02:00
|
|
|
|
$langs->load("users");
|
|
|
|
|
|
|
|
|
|
|
|
|
2003-02-20 18:40:42 +01:00
|
|
|
|
$form = new Form($db);
|
2002-05-06 21:10:48 +02:00
|
|
|
|
|
2004-06-09 12:39:40 +02:00
|
|
|
|
$action=isset($_GET["action"])?$_GET["action"]:$_POST["action"];
|
|
|
|
|
|
|
2004-10-01 20:05:38 +02:00
|
|
|
|
|
2003-11-21 18:33:36 +01:00
|
|
|
|
if ($_GET["subaction"] == 'addrights' && $user->admin)
|
2003-08-10 14:44:43 +02:00
|
|
|
|
{
|
2005-01-14 16:39:46 +01:00
|
|
|
|
$edituser = new User($db,$_GET["id"]);
|
|
|
|
|
|
$edituser->addrights($_GET["rights"]);
|
2003-08-10 14:44:43 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2003-11-21 18:33:36 +01:00
|
|
|
|
if ($_GET["subaction"] == 'delrights' && $user->admin)
|
2003-08-10 14:44:43 +02:00
|
|
|
|
{
|
2005-01-14 16:39:46 +01:00
|
|
|
|
$edituser = new User($db,$_GET["id"]);
|
|
|
|
|
|
$edituser->delrights($_GET["rights"]);
|
2003-08-10 14:44:43 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2004-06-09 12:39:40 +02:00
|
|
|
|
if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == "yes")
|
2003-08-10 14:44:43 +02:00
|
|
|
|
{
|
2004-10-01 20:05:38 +02:00
|
|
|
|
if ($_GET["id"] <> $user->id)
|
2003-08-10 14:44:43 +02:00
|
|
|
|
{
|
2004-07-27 18:26:41 +02:00
|
|
|
|
$edituser = new User($db, $_GET["id"]);
|
|
|
|
|
|
$edituser->fetch($_GET["id"]);
|
|
|
|
|
|
$edituser->delete();
|
|
|
|
|
|
Header("Location: index.php");
|
2003-08-10 14:44:43 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2005-01-02 16:27:37 +01:00
|
|
|
|
/**
|
|
|
|
|
|
* Action ajout user
|
|
|
|
|
|
*/
|
2004-06-09 12:39:40 +02:00
|
|
|
|
if ($_POST["action"] == 'add' && $user->admin)
|
2002-12-13 17:51:03 +01:00
|
|
|
|
{
|
2005-01-14 16:39:46 +01:00
|
|
|
|
$message="";
|
|
|
|
|
|
if (! $_POST["nom"]) {
|
|
|
|
|
|
$message='<div class="error">'.$langs->trans("NameNotDefined").'</div>';
|
|
|
|
|
|
$action="create"; // Go back to create page
|
|
|
|
|
|
}
|
|
|
|
|
|
if (! $_POST["login"]) {
|
|
|
|
|
|
$message='<div class="error">'.$langs->trans("LoginNotDefined").'</div>';
|
|
|
|
|
|
$action="create"; // Go back to create page
|
|
|
|
|
|
}
|
|
|
|
|
|
if (! $message) {
|
|
|
|
|
|
$edituser = new User($db,0);
|
2005-01-02 16:27:37 +01:00
|
|
|
|
|
2005-01-14 16:39:46 +01:00
|
|
|
|
$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"]);
|
2005-01-02 16:27:37 +01:00
|
|
|
|
|
2005-01-14 16:39:46 +01:00
|
|
|
|
$id = $edituser->create();
|
2005-01-02 16:27:37 +01:00
|
|
|
|
|
2005-01-14 16:39:46 +01:00
|
|
|
|
if ($id) {
|
|
|
|
|
|
if (isset($_POST['password']) && trim($_POST['password']))
|
|
|
|
|
|
{
|
|
|
|
|
|
$edituser->password(trim($_POST['password']),$conf->password_encrypted);
|
|
|
|
|
|
}
|
2005-01-02 16:27:37 +01:00
|
|
|
|
|
2005-01-14 16:39:46 +01:00
|
|
|
|
Header("Location: fiche.php?id=$id");
|
|
|
|
|
|
}
|
|
|
|
|
|
else {
|
|
|
|
|
|
$message='<div class="error">'.$langs->trans("LoginAlreadyExists",$edituser->login).'</div>';
|
|
|
|
|
|
$action="create"; // Go back to create page
|
2004-07-31 17:27:37 +02:00
|
|
|
|
}
|
2005-01-14 16:39:46 +01:00
|
|
|
|
}
|
2002-05-06 21:10:48 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2004-06-09 12:39:40 +02:00
|
|
|
|
if ($_POST["action"] == 'update' && $user->admin)
|
2002-12-13 17:51:03 +01:00
|
|
|
|
{
|
2004-07-21 11:59:06 +02:00
|
|
|
|
$edituser = new User($db, $_GET["id"]);
|
|
|
|
|
|
$edituser->fetch();
|
|
|
|
|
|
|
|
|
|
|
|
$edituser->nom = $_POST["nom"];
|
|
|
|
|
|
$edituser->note = $_POST["note"];
|
|
|
|
|
|
$edituser->prenom = $_POST["prenom"];
|
|
|
|
|
|
$edituser->login = $_POST["login"];
|
|
|
|
|
|
$edituser->email = $_POST["email"];
|
|
|
|
|
|
$edituser->admin = $_POST["admin"];
|
|
|
|
|
|
$edituser->webcal_login = $_POST["webcal_login"];
|
|
|
|
|
|
|
|
|
|
|
|
if (! $edituser->update())
|
2002-12-19 19:55:38 +01:00
|
|
|
|
{
|
2004-07-21 11:59:06 +02:00
|
|
|
|
print $edituser->error();
|
2002-12-19 19:55:38 +01:00
|
|
|
|
}
|
2004-07-21 11:59:06 +02:00
|
|
|
|
if (isset($password) && $password !='' )
|
2003-06-20 16:30:08 +02:00
|
|
|
|
{
|
2004-07-21 11:59:06 +02:00
|
|
|
|
$edituser->password($password,$conf->password_encrypted);
|
2003-06-20 16:30:08 +02:00
|
|
|
|
}
|
2002-12-19 19:55:38 +01:00
|
|
|
|
}
|
2002-05-06 21:10:48 +02:00
|
|
|
|
|
2004-07-29 15:22:34 +02:00
|
|
|
|
if ($_GET["action"] == 'password' && $user->admin)
|
2002-12-19 19:55:38 +01:00
|
|
|
|
{
|
2005-01-14 16:39:46 +01:00
|
|
|
|
$edituser = new User($db, $_GET["id"]);
|
|
|
|
|
|
$edituser->fetch();
|
2002-12-19 19:55:38 +01:00
|
|
|
|
|
2005-01-14 16:39:46 +01:00
|
|
|
|
if ($edituser->password('',$conf->password_encrypted))
|
2002-12-19 19:55:38 +01:00
|
|
|
|
{
|
2005-01-14 16:39:46 +01:00
|
|
|
|
$message = "Mot de passe chang<6E> et envoy<6F> <20> $edituser->email";
|
2002-12-19 19:55:38 +01:00
|
|
|
|
}
|
2002-05-06 21:10:48 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2004-06-09 12:39:40 +02:00
|
|
|
|
|
2003-08-10 14:44:43 +02:00
|
|
|
|
llxHeader();
|
2002-12-19 19:55:38 +01:00
|
|
|
|
|
2004-06-09 12:39:40 +02:00
|
|
|
|
|
2002-12-13 17:51:03 +01:00
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
/* */
|
2004-10-10 17:51:19 +02:00
|
|
|
|
/* Affichage fiche en mode cr<63>ation */
|
2002-12-13 17:51:03 +01:00
|
|
|
|
/* */
|
|
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
|
|
|
|
|
|
if ($action == 'create')
|
|
|
|
|
|
{
|
|
|
|
|
|
|
2005-01-14 16:39:46 +01:00
|
|
|
|
print_titre($langs->trans("NewUser"));
|
2004-07-31 17:27:37 +02:00
|
|
|
|
|
2005-01-14 16:39:46 +01:00
|
|
|
|
if ($message) { print "<br>".$message."<br>"; }
|
2004-06-09 12:39:40 +02:00
|
|
|
|
|
2005-01-14 16:39:46 +01:00
|
|
|
|
print '<form action="fiche.php" method="post">';
|
|
|
|
|
|
print '<input type="hidden" name="action" value="add">';
|
2004-06-09 12:39:40 +02:00
|
|
|
|
|
2005-01-14 16:39:46 +01:00
|
|
|
|
print '<table class="border" width="100%">';
|
2004-06-09 12:39:40 +02:00
|
|
|
|
|
2005-01-14 16:39:46 +01:00
|
|
|
|
print "<tr>".'<td valign="top">'.$langs->trans("Lastname").'</td>';
|
|
|
|
|
|
print '<td class="valeur"><input size="30" type="text" name="nom" value=""></td></tr>';
|
2004-06-09 12:39:40 +02:00
|
|
|
|
|
2005-01-14 16:39:46 +01:00
|
|
|
|
print '<tr><td valign="top" width="20%">'.$langs->trans("Firstname").'</td>';
|
|
|
|
|
|
print '<td class="valeur"><input size="30" type="text" name="prenom" value=""></td></tr>';
|
2005-01-02 16:27:37 +01:00
|
|
|
|
|
2005-01-14 16:39:46 +01:00
|
|
|
|
print "<tr>".'<td valign="top">'.$langs->trans("Login").'</td>';
|
|
|
|
|
|
print '<td class="valeur"><input size="20" type="text" name="login" value=""></td></tr>';
|
2004-06-09 12:39:40 +02:00
|
|
|
|
|
2005-01-14 16:39:46 +01:00
|
|
|
|
print "<tr>".'<td valign="top">'.$langs->trans("Password").'</td>';
|
|
|
|
|
|
print '<td class="valeur"><input size="30" type="text" name="password" value=""></td></tr>';
|
2004-06-09 12:39:40 +02:00
|
|
|
|
|
2005-01-14 16:39:46 +01:00
|
|
|
|
print "<tr>".'<td valign="top">'.$langs->trans("EMail").'</td>';
|
|
|
|
|
|
print '<td class="valeur"><input size="40" type="text" name="email" value=""></td></tr>';
|
2004-06-09 12:39:40 +02:00
|
|
|
|
|
2005-01-14 16:39:46 +01:00
|
|
|
|
print "<tr>".'<td valign="top">'.$langs->trans("Administrator").'</td>';
|
|
|
|
|
|
print '<td class="valeur">';
|
|
|
|
|
|
$form->selectyesnonum('admin',0);
|
|
|
|
|
|
print "</td></tr>\n";
|
2004-06-09 12:39:40 +02:00
|
|
|
|
|
2005-01-14 16:39:46 +01:00
|
|
|
|
print "<tr>".'<td valign="top">'.$langs->trans("Note").'</td><td>';
|
|
|
|
|
|
print "<textarea name=\"note\" rows=\"12\" cols=\"40\">";
|
|
|
|
|
|
print "</textarea></td></tr>\n";
|
2004-07-31 17:27:37 +02:00
|
|
|
|
|
2005-01-14 16:39:46 +01:00
|
|
|
|
// Autres caract<63>ristiques issus des autres modules
|
|
|
|
|
|
if ($conf->webcal->enabled)
|
2003-11-19 15:39:35 +01:00
|
|
|
|
{
|
2005-01-14 16:39:46 +01:00
|
|
|
|
print "<tr>".'<td valign="top">'.$langs->trans("LoginWebcal").'</td>';
|
|
|
|
|
|
print '<td class="valeur"><input size="30" type="text" name="webcal_login" value=""></td></tr>';
|
2003-11-19 15:39:35 +01:00
|
|
|
|
}
|
2004-06-09 12:39:40 +02:00
|
|
|
|
|
2005-01-14 16:39:46 +01:00
|
|
|
|
print "<tr>".'<td align="center" colspan="2"><input value="'.$langs->trans("CreateUser").'" type="submit"></td></tr>';
|
|
|
|
|
|
print "</form>";
|
|
|
|
|
|
print "</table>\n";
|
2002-12-13 17:51:03 +01:00
|
|
|
|
}
|
2004-07-31 17:27:37 +02:00
|
|
|
|
|
|
|
|
|
|
|
2002-12-13 17:51:03 +01:00
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
/* */
|
2002-12-19 19:55:38 +01:00
|
|
|
|
/* Visu et edition */
|
2002-12-13 17:51:03 +01:00
|
|
|
|
/* */
|
|
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2005-01-14 16:39:46 +01:00
|
|
|
|
if ($_GET["id"])
|
2002-12-19 19:55:38 +01:00
|
|
|
|
{
|
2005-01-14 16:39:46 +01:00
|
|
|
|
$fuser = new User($db, $_GET["id"]);
|
|
|
|
|
|
$fuser->fetch();
|
|
|
|
|
|
$fuser->getrights();
|
2004-06-09 12:39:40 +02:00
|
|
|
|
|
2005-01-14 16:39:46 +01:00
|
|
|
|
/*
|
|
|
|
|
|
* Affichage onglets
|
|
|
|
|
|
*/
|
2004-07-31 17:27:37 +02:00
|
|
|
|
|
2005-01-14 16:39:46 +01:00
|
|
|
|
$h = 0;
|
2004-07-31 17:27:37 +02:00
|
|
|
|
|
2005-01-14 16:39:46 +01:00
|
|
|
|
$head[$h][0] = DOL_URL_ROOT.'/user/fiche.php?id='.$fuser->id;
|
|
|
|
|
|
$head[$h][1] = $langs->trans("UserCard");
|
|
|
|
|
|
if ($_GET["action"] != 'perms') { $hselected=$h; }
|
|
|
|
|
|
$h++;
|
2004-07-31 17:27:37 +02:00
|
|
|
|
|
2005-01-14 16:39:46 +01:00
|
|
|
|
if ($user->admin)
|
2004-07-31 17:27:37 +02:00
|
|
|
|
{
|
2005-01-14 16:39:46 +01:00
|
|
|
|
$head[$h][0] = DOL_URL_ROOT.'/user/fiche.php?action=perms&id='.$fuser->id;
|
|
|
|
|
|
$head[$h][1] = $langs->trans("Permissions");
|
|
|
|
|
|
if ($_GET["action"] == 'perms') { $hselected=$h; }
|
|
|
|
|
|
$h++;
|
2004-07-31 17:27:37 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2005-01-14 16:39:46 +01:00
|
|
|
|
$head[$h][0] = DOL_URL_ROOT.'/user/addon.php?id='.$fuser->id;
|
|
|
|
|
|
$head[$h][1] = $langs->trans("Addons");
|
|
|
|
|
|
$h++;
|
2004-07-31 17:27:37 +02:00
|
|
|
|
|
2005-01-14 16:39:46 +01:00
|
|
|
|
dolibarr_fiche_head($head, $hselected, $fuser->fullname);
|
2004-07-31 17:27:37 +02:00
|
|
|
|
|
|
|
|
|
|
|
2005-01-14 16:39:46 +01:00
|
|
|
|
/*
|
|
|
|
|
|
* Confirmation suppression
|
|
|
|
|
|
*/
|
|
|
|
|
|
if ($action == 'delete')
|
2004-06-09 12:39:40 +02:00
|
|
|
|
{
|
2005-01-14 16:39:46 +01:00
|
|
|
|
$html = new Form($db);
|
|
|
|
|
|
$html->form_confirm("fiche.php?id=$fuser->id",$langs->trans("DisableAUser"),$langs->trans("ConfirmDisableUser",$fuser->login),"confirm_delete");
|
2004-06-09 12:39:40 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2004-07-31 17:27:37 +02:00
|
|
|
|
|
|
|
|
|
|
|
2005-01-14 16:39:46 +01:00
|
|
|
|
if ($_GET["action"] == 'perms')
|
2004-06-09 12:39:40 +02:00
|
|
|
|
{
|
2004-12-02 18:06:08 +01:00
|
|
|
|
if ($message) { print "$message<br>"; }
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
* Ecran ajout/suppression permission
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
print '<table class="noborder" width="100%">';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Droits existant
|
|
|
|
|
|
print "<tr>".'<td valign="top" colspan="2">';
|
|
|
|
|
|
print '<table width="100%" class="noborder">';
|
|
|
|
|
|
print '<tr class="liste_titre"><td>'.$langs->trans("AvailableRights").'</td><td>'.$langs->trans("Module").'</td><td> </td></tr>';
|
|
|
|
|
|
$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))
|
2004-06-09 12:39:40 +02:00
|
|
|
|
{
|
2004-12-02 18:06:08 +01:00
|
|
|
|
$num = $db->num_rows();
|
|
|
|
|
|
$i = 0;
|
|
|
|
|
|
$var = True;
|
|
|
|
|
|
while ($i < $num)
|
2004-06-09 12:39:40 +02:00
|
|
|
|
{
|
2004-12-02 18:06:08 +01:00
|
|
|
|
$obj = $db->fetch_object($i);
|
|
|
|
|
|
if ($oldmod <> $obj->module)
|
2004-06-09 12:39:40 +02:00
|
|
|
|
{
|
2004-12-02 18:06:08 +01:00
|
|
|
|
$oldmod = $obj->module;
|
|
|
|
|
|
$var = !$var;
|
2004-06-09 12:39:40 +02:00
|
|
|
|
}
|
2004-12-02 18:06:08 +01:00
|
|
|
|
print '<tr '. $bc[$var].'>';
|
|
|
|
|
|
print '<td>'.$obj->libelle . '</td><td>'.$obj->module . '</td>';
|
|
|
|
|
|
print '<td><a href="fiche.php?id='.$fuser->id.'&action=perms&subaction=addrights&rights='.$obj->id.'">'.img_edit_add().'</a></td>';
|
|
|
|
|
|
print '</tr>';
|
|
|
|
|
|
|
|
|
|
|
|
$i++;
|
2004-06-09 12:39:40 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2004-12-02 18:06:08 +01:00
|
|
|
|
print '</table>';
|
|
|
|
|
|
|
|
|
|
|
|
print '</td><td colspan="2" valign="top">';
|
|
|
|
|
|
|
|
|
|
|
|
// Droits poss<73>d<EFBFBD>s
|
|
|
|
|
|
print '<table class="noborder" width="100%">';
|
|
|
|
|
|
print '<tr class="liste_titre"><td> </td><td>'.$langs->trans("OwnedRights").'</td><td>'.$langs->trans("Module").'</td></tr>';
|
|
|
|
|
|
$sql = "SELECT r.id, r.libelle, r.module FROM ".MAIN_DB_PREFIX."rights_def as r, ".MAIN_DB_PREFIX."user_rights as ur";
|
|
|
|
|
|
$sql .= " WHERE ur.fk_id = r.id AND ur.fk_user = ".$fuser->id. " ORDER BY r.module, r.id ASC";
|
|
|
|
|
|
$var = True;
|
|
|
|
|
|
if ($db->query($sql))
|
2004-06-09 12:39:40 +02:00
|
|
|
|
{
|
2004-12-02 18:06:08 +01:00
|
|
|
|
$num = $db->num_rows();
|
|
|
|
|
|
$i = 0;
|
|
|
|
|
|
while ($i < $num)
|
2004-06-09 12:39:40 +02:00
|
|
|
|
{
|
2004-12-02 18:06:08 +01:00
|
|
|
|
$obj = $db->fetch_object($i);
|
|
|
|
|
|
if ($oldmod <> $obj->module)
|
2004-06-09 12:39:40 +02:00
|
|
|
|
{
|
2004-12-02 18:06:08 +01:00
|
|
|
|
$oldmod = $obj->module;
|
|
|
|
|
|
$var = !$var;
|
2004-06-09 12:39:40 +02:00
|
|
|
|
}
|
2004-12-02 18:06:08 +01:00
|
|
|
|
|
|
|
|
|
|
print "<tr $bc[$var]>";
|
2004-12-22 21:50:38 +01:00
|
|
|
|
print " <td align= \"right\"><a href=\"fiche.php?id=".$fuser->id."&action=perms&subaction=delrights&rights=".$obj->id."\">".img_edit_remove()."</a></td>\n";
|
|
|
|
|
|
print " <td>".$obj->libelle . "</td><td>".$obj->module . "</td>\n";
|
|
|
|
|
|
print "</tr>";
|
2004-12-02 18:06:08 +01:00
|
|
|
|
$i++;
|
2004-06-09 12:39:40 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2004-12-02 18:06:08 +01:00
|
|
|
|
print '</table>';
|
|
|
|
|
|
print '</td></tr>';
|
2004-06-09 12:39:40 +02:00
|
|
|
|
}
|
2004-12-02 18:06:08 +01:00
|
|
|
|
|
|
|
|
|
|
|
2005-01-14 16:39:46 +01:00
|
|
|
|
if ($_GET["action"] != 'perms' && $_GET["action"] != 'edit')
|
|
|
|
|
|
{
|
|
|
|
|
|
/*
|
|
|
|
|
|
* Fiche en mode visu
|
|
|
|
|
|
*/
|
2004-12-02 18:06:08 +01:00
|
|
|
|
|
2005-01-14 16:39:46 +01:00
|
|
|
|
print '<table class="border" width="100%">';
|
2004-12-02 18:06:08 +01:00
|
|
|
|
|
2005-01-16 21:21:58 +01:00
|
|
|
|
print '<tr><td width="25%" valign="top">'.$langs->trans("Lastname").'</td>';
|
|
|
|
|
|
print '<td colspan="2" width="50%" class="valeur">'.$fuser->nom.'</td>';
|
2005-01-16 21:28:37 +01:00
|
|
|
|
print '<td align="center" valign="middle" width="50%" rowspan="8">';
|
2005-01-16 21:21:58 +01:00
|
|
|
|
if (file_exists($conf->users->dir_output."/".$fuser->id.".jpg"))
|
|
|
|
|
|
{
|
|
|
|
|
|
print '<img src="'.DOL_URL_ROOT.'/image.php?modulepart=userphoto&file='.$fuser->id.'.jpg">';
|
|
|
|
|
|
}
|
|
|
|
|
|
else {
|
|
|
|
|
|
print '<img src="'.DOL_URL_ROOT.'/theme/nophoto.jpg">';
|
|
|
|
|
|
}
|
|
|
|
|
|
print '</td></tr>';
|
|
|
|
|
|
|
|
|
|
|
|
print '<tr><td width="25%" valign="top">'.$langs->trans("Firstname").'</td>';
|
|
|
|
|
|
print '<td colspan="2" width="50%" class="valeur">'.$fuser->prenom.'</td>';
|
2005-01-14 16:39:46 +01:00
|
|
|
|
print "</tr>\n";
|
2004-12-02 18:06:08 +01:00
|
|
|
|
|
2005-01-16 21:21:58 +01:00
|
|
|
|
print '<tr><td width="25%" valign="top">'.$langs->trans("Login").'</td>';
|
|
|
|
|
|
print '<td colspan="2" width="50%" class="valeur">'.$fuser->login.'</td></tr>';
|
|
|
|
|
|
|
|
|
|
|
|
print '<tr><td width="25%" valign="top">'.$langs->trans("EMail").'</td>';
|
|
|
|
|
|
print '<td colspan="2" width="50%" class="valeur"><a href="mailto:'.$fuser->email.'">'.$fuser->email.'</a></td>';
|
2005-01-14 16:39:46 +01:00
|
|
|
|
print "</tr>\n";
|
2004-06-20 01:51:21 +02:00
|
|
|
|
|
2005-01-16 21:21:58 +01:00
|
|
|
|
print '<tr><td width="25%" valign="top">'.$langs->trans("Administrator").'</td>';
|
|
|
|
|
|
print '<td colspan="2" class="valeur">'.yn($fuser->admin).'</td>';
|
2005-01-14 16:39:46 +01:00
|
|
|
|
print "</tr>\n";
|
|
|
|
|
|
|
2005-01-16 21:21:58 +01:00
|
|
|
|
print '<tr><td width="25%" valign="top">'.$langs->trans("DateCreation").'</td>';
|
|
|
|
|
|
print '<td colspan="2" class="valeur">'.dolibarr_print_date($fuser->datec).'</td>';
|
|
|
|
|
|
print "</tr>\n";
|
|
|
|
|
|
|
|
|
|
|
|
print '<tr><td width="25%" valign="top">'.$langs->trans("DateModification").'</td>';
|
|
|
|
|
|
print '<td colspan="2" class="valeur">'.dolibarr_print_date($fuser->datem).'</td>';
|
|
|
|
|
|
print "</tr>\n";
|
2005-01-14 16:39:46 +01:00
|
|
|
|
|
|
|
|
|
|
print "<tr>".'<td width="25%" valign="top">'.$langs->trans("ContactCard").'</td>';
|
2005-01-16 21:21:58 +01:00
|
|
|
|
print '<td>';
|
2005-01-14 16:39:46 +01:00
|
|
|
|
if ($fuser->contact_id)
|
2004-06-09 12:39:40 +02:00
|
|
|
|
{
|
2005-01-14 16:39:46 +01:00
|
|
|
|
print '<a href="../contact/fiche.php?id='.$fuser->contact_id.'">'.$langs->trans("ContactCard").'</a>';
|
2004-06-09 12:39:40 +02:00
|
|
|
|
}
|
2005-01-14 16:39:46 +01:00
|
|
|
|
else
|
2004-06-09 12:39:40 +02:00
|
|
|
|
{
|
2005-01-14 16:39:46 +01:00
|
|
|
|
print $langs->trans("NoContactCard");
|
2004-06-09 12:39:40 +02:00
|
|
|
|
}
|
2005-01-14 16:39:46 +01:00
|
|
|
|
print '</td>';
|
|
|
|
|
|
print "</tr>\n";
|
2005-01-16 21:21:58 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($fuser->societe_id > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
$societe = new Societe($db);
|
|
|
|
|
|
$societe->fetch($fuser->societe_id);
|
|
|
|
|
|
print "<tr>".'<td width="25%" valign="top">'.$langs->trans("Company").'</td>';
|
|
|
|
|
|
print '<td colspan="3">'.$societe->nom.' </td>';
|
|
|
|
|
|
print "</tr>\n";
|
|
|
|
|
|
}
|
2004-06-09 12:39:40 +02:00
|
|
|
|
|
2005-01-14 16:39:46 +01:00
|
|
|
|
print "<tr>".'<td width="25%" valign="top">'.$langs->trans("Note").'</td>';
|
|
|
|
|
|
print '<td colspan="3" class="valeur">'.nl2br($fuser->note).' </td>';
|
|
|
|
|
|
print "</tr>\n";
|
2004-06-09 12:39:40 +02:00
|
|
|
|
|
2005-01-14 16:39:46 +01:00
|
|
|
|
// Autres caract<63>ristiques issus des autres modules
|
|
|
|
|
|
if ($conf->webcal->enabled)
|
2004-06-09 12:39:40 +02:00
|
|
|
|
{
|
2005-01-14 16:39:46 +01:00
|
|
|
|
$langs->load("other");
|
|
|
|
|
|
print '<tr><td width="25%" valign="top">'.$langs->trans("LoginWebcal").'</td>';
|
|
|
|
|
|
print '<td colspan="3">'.$fuser->webcal_login.' </td>';
|
|
|
|
|
|
print "</tr>\n";
|
2004-06-09 12:39:40 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2005-01-14 16:39:46 +01:00
|
|
|
|
print "</table>\n";
|
|
|
|
|
|
print "<br>\n";
|
2004-06-09 12:39:40 +02:00
|
|
|
|
|
2005-01-14 16:39:46 +01:00
|
|
|
|
print "</div>\n";
|
2004-06-09 12:39:40 +02:00
|
|
|
|
|
2004-07-31 17:27:37 +02:00
|
|
|
|
|
2005-01-14 16:39:46 +01:00
|
|
|
|
/*
|
|
|
|
|
|
* Barre d'actions
|
|
|
|
|
|
*
|
|
|
|
|
|
*/
|
|
|
|
|
|
print '<div class="tabsAction">';
|
2004-07-31 17:27:37 +02:00
|
|
|
|
|
2005-01-14 16:39:46 +01:00
|
|
|
|
if ($user->admin)
|
2004-07-31 17:27:37 +02:00
|
|
|
|
{
|
2005-01-14 16:39:46 +01:00
|
|
|
|
print '<a class="tabAction" href="fiche.php?id='.$fuser->id.'&action=edit">'.$langs->trans("Edit").'</a>';
|
2004-07-31 17:27:37 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2005-01-14 16:39:46 +01:00
|
|
|
|
if ($user->id == $_GET["id"] or $user->admin)
|
2004-07-31 17:27:37 +02:00
|
|
|
|
{
|
2005-01-14 16:39:46 +01:00
|
|
|
|
print '<a class="tabAction" href="fiche.php?id='.$fuser->id.'&action=password">'.$langs->trans("SendNewPassword").'</a>';
|
2004-07-31 17:27:37 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2005-01-14 16:39:46 +01:00
|
|
|
|
if ($user->id <> $_GET["id"] && $user->admin)
|
2004-07-31 17:27:37 +02:00
|
|
|
|
{
|
2005-01-14 16:39:46 +01:00
|
|
|
|
print '<a class="butDelete" href="fiche.php?action=delete&id='.$fuser->id.'">'.$langs->trans("DisableUser").'</a>';
|
2004-07-31 17:27:37 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2005-01-14 16:39:46 +01:00
|
|
|
|
print "</div>\n";
|
|
|
|
|
|
print "<br>\n";
|
2004-12-02 18:06:08 +01:00
|
|
|
|
|
2005-01-14 16:39:46 +01:00
|
|
|
|
}
|
2004-12-02 18:06:08 +01:00
|
|
|
|
|
2005-01-14 16:39:46 +01:00
|
|
|
|
/*
|
|
|
|
|
|
* Fiche en mode edition
|
|
|
|
|
|
*/
|
|
|
|
|
|
if ($_GET["action"] == 'edit' && $user->admin)
|
2004-06-09 12:39:40 +02:00
|
|
|
|
{
|
2005-01-14 16:39:46 +01:00
|
|
|
|
print '<form action="fiche.php?id='.$fuser->id.'" method="post">';
|
|
|
|
|
|
print '<input type="hidden" name="action" value="update">';
|
2005-01-16 21:21:58 +01:00
|
|
|
|
print '<table width="100%" class="border">';
|
2005-01-14 16:39:46 +01:00
|
|
|
|
|
|
|
|
|
|
print "<tr>".'<td valign="top">'.$langs->trans("Lastname").'</td>';
|
|
|
|
|
|
print '<td><input size="30" type="text" name="nom" value="'.$fuser->nom.'"></td></tr>';
|
|
|
|
|
|
|
|
|
|
|
|
print "<tr>".'<td valign="top">'.$langs->trans("Firstname").'</td>';
|
2005-01-16 21:21:58 +01:00
|
|
|
|
print '<td><input size="30" type="text" name="prenom" value="'.$fuser->prenom.'"></td></tr>';
|
2005-01-14 16:39:46 +01:00
|
|
|
|
|
|
|
|
|
|
print "<tr>".'<td valign="top">'.$langs->trans("Login").'</td>';
|
2005-01-16 21:21:58 +01:00
|
|
|
|
print '<td><input size="12" maxlength="8" type="text" name="login" value="'.$fuser->login.'"></td></tr>';
|
2005-01-14 16:39:46 +01:00
|
|
|
|
|
|
|
|
|
|
print "<tr>".'<td valign="top">'.$langs->trans("EMail").'</td>';
|
|
|
|
|
|
print '<td><input size="30" type="text" name="email" value="'.$fuser->email.'"></td></tr>';
|
|
|
|
|
|
|
|
|
|
|
|
print "<tr>".'<td valign="top">'.$langs->trans("Administrator").'</td>';
|
|
|
|
|
|
if ($fuser->societe_id > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
print '<td class="valeur">';
|
|
|
|
|
|
print '<input type="hidden" name="admin" value="0">'.$langs->trans("No");
|
|
|
|
|
|
print '</td></tr>';
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
print '<td class="valeur">';
|
|
|
|
|
|
$form->selectyesnonum('admin',$fuser->admin);
|
|
|
|
|
|
print '</td></tr>';
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
print "<tr>".'<td valign="top">'.$langs->trans("Note").'</td><td>';
|
|
|
|
|
|
print "<textarea name=\"note\" rows=\"10\" cols=\"40\">";
|
|
|
|
|
|
print $fuser->note;
|
|
|
|
|
|
print "</textarea></td></tr>";
|
|
|
|
|
|
|
|
|
|
|
|
// Autres caract<63>ristiques issus des autres modules
|
|
|
|
|
|
$langs->load("other");
|
|
|
|
|
|
print "<tr>".'<td valign="top">'.$langs->trans("LoginWebcal").'</td>';
|
|
|
|
|
|
print '<td class="valeur"><input size="30" type="text" name="webcal_login" value="'.$fuser->webcal_login.'"></td></tr>';
|
|
|
|
|
|
|
|
|
|
|
|
print "<tr>".'<td align="center" colspan="2"><input value="'.$langs->trans("Save").'" type="submit"></td></tr>';
|
|
|
|
|
|
|
|
|
|
|
|
print '</table><br>';
|
|
|
|
|
|
print '</form>';
|
2004-06-09 12:39:40 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2002-12-19 19:55:38 +01:00
|
|
|
|
}
|
2004-06-09 12:39:40 +02:00
|
|
|
|
|
2002-05-06 21:10:48 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$db->close();
|
|
|
|
|
|
|
|
|
|
|
|
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
|
|
|
|
|
?>
|