diff --git a/htdocs/user/fiche.php b/htdocs/user/fiche.php
index de8d554fbae..506d1d88cb3 100644
--- a/htdocs/user/fiche.php
+++ b/htdocs/user/fiche.php
@@ -30,12 +30,13 @@
\version $Revision$
*/
-
require("./pre.inc.php");
+require_once(DOL_DOCUMENT_ROOT."/contact.class.php");
+
if ($user->id <> $_GET["id"])
{
- if (! $user->rights->user->user->lire && !$user->admin)
+ if (! $user->rights->user->user->lire && ! $user->admin)
{
accessforbidden();
}
@@ -105,15 +106,15 @@ if ($_POST["action"] == 'add' && $user->admin)
$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->admin = trim($_POST["admin"]);
$edituser->office_phone = trim($_POST["office_phone"]);
$edituser->office_fax = trim($_POST["office_fax"]);
$edituser->user_mobile = trim($_POST["user_mobile"]);
$edituser->email = trim($_POST["email"]);
- $edituser->admin = trim($_POST["admin"]);
$edituser->webcal_login = trim($_POST["webcal_login"]);
+ $edituser->note = trim($_POST["note"]);
$db->begin();
@@ -174,14 +175,15 @@ if ($_POST["action"] == 'update' && $user->admin)
$edituser->fetch();
$edituser->nom = $_POST["nom"];
- $edituser->note = $_POST["note"];
$edituser->prenom = $_POST["prenom"];
$edituser->login = $_POST["login"];
+ $edituser->pass = $_POST["pass"];
+ $edituser->admin = $_POST["admin"];
$edituser->office_phone = $_POST["office_phone"];
$edituser->office_fax = $_POST["office_fax"];
$edituser->user_mobile = $_POST["user_mobile"];
$edituser->email = $_POST["email"];
- $edituser->admin = $_POST["admin"];
+ $edituser->note = $_POST["note"];
$edituser->webcal_login = $_POST["webcal_login"];
$ret=$edituser->update();
@@ -298,6 +300,11 @@ if ($action == 'create')
print '
'.$langs->trans("Password").' ';
print ' ';
+ print ''.$langs->trans("Administrator").' ';
+ print '';
+ $form->selectyesnonum('admin',0);
+ print " \n";
+
print ''.$langs->trans("Phone").' ';
print ' ';
@@ -310,13 +317,8 @@ if ($action == 'create')
print ''.$langs->trans("EMail").' ';
print ' ';
- print ''.$langs->trans("Administrator").' ';
- print '';
- $form->selectyesnonum('admin',0);
- print " \n";
-
print ''.$langs->trans("Note").' ';
- print " \n";
// Autres caractéristiques issus des autres modules
@@ -430,7 +432,7 @@ else
print ''.$langs->trans("Lastname").' ';
print ''.$fuser->nom.' ';
- print '';
+ print ' ';
if (file_exists($conf->users->dir_output."/".$fuser->id.".jpg"))
{
print ' ';
@@ -455,6 +457,54 @@ else
print ' '.$langs->trans("LoginAccountDisable").' ';
}
+ // Password
+ print ''.$langs->trans("Password").' ';
+ print ''.eregi_replace('.','*',$fuser->pass).' ';
+ print " \n";
+
+ // Administrateur
+ print ''.$langs->trans("Administrator").' ';
+ print ''.yn($fuser->admin);
+ if ($fuser->admin) print ' '.img_picto($langs->trans("Administrator"),"star");
+ print ' ';
+ print " \n";
+
+ // Source
+ print ''.$langs->trans("Source").' ';
+ print '';
+ if ($fuser->societe_id)
+ {
+ print $langs->trans("External");
+ }
+ else
+ {
+ print $langs->trans("Internal");
+ }
+ print ' ';
+
+ // Company / Contact
+ print ''.$langs->trans("Company").' / '.$langs->trans("Contact").' ';
+ print '';
+ if ($fuser->societe_id > 0)
+ {
+ $societe = new Societe($db);
+ $societe->fetch($fuser->societe_id);
+ print ''.img_object($langs->trans("ShowCompany"),'company').' '.dolibarr_trunc($societe->nom,32).' ';
+ if ($fuser->contact_id)
+ {
+ $contact = new Contact($db);
+ $contact->fetch($fuser->contact_id);
+ print ' / '.''.img_object($langs->trans("ShowContact"),'contact').' '.dolibarr_trunc($contact->fullname,32).' ';
+ }
+ }
+ else
+ {
+ print $langs->trans("ThisUserIsNot");
+ }
+ print ' ';
+ print " \n";
+
+ // Tel, fax, portable
print ''.$langs->trans("Phone").' ';
print ''.$fuser->office_phone.' ';
print ''.$langs->trans("Fax").' ';
@@ -466,12 +516,6 @@ else
print ''.$fuser->email.' ';
print " \n";
- print ''.$langs->trans("Administrator").' ';
- print ''.yn($fuser->admin);
- if ($fuser->admin) print ' '.img_picto($langs->trans("Administrator"),"star");
- print ' ';
- print " \n";
-
print ''.$langs->trans("DateCreation").' ';
print ''.dolibarr_print_date($fuser->datec).' ';
print " \n";
@@ -480,28 +524,6 @@ else
print ''.dolibarr_print_date($fuser->datem).' ';
print "\n";
- print "".''.$langs->trans("ContactCard").' ';
- print '';
- if ($fuser->contact_id)
- {
- print ''.$langs->trans("ContactCard").' ';
- }
- else
- {
- print $langs->trans("ThisUserIsNot");
- }
- print ' ';
- print " \n";
-
- if ($fuser->societe_id > 0)
- {
- $societe = new Societe($db);
- $societe->fetch($fuser->societe_id);
- print "".''.$langs->trans("Company").' ';
- print ''.$societe->nom.' ';
- print " \n";
- }
-
print "".''.$langs->trans("Note").' ';
print ''.nl2br($fuser->note).' ';
print " \n";
@@ -526,7 +548,7 @@ else
*/
print '';
- if ($user->admin)
+ if ($user->admin || ($user->id == $fuser->id))
{
print '
'.$langs->trans("Edit").' ';
}
@@ -672,16 +694,19 @@ else
/*
* Fiche en mode edition
*/
- if ($_GET["action"] == 'edit' && $user->admin)
+ if ($_GET["action"] == 'edit' && ($user->admin || ($user->id == $fuser->id)))
{
print '
';
print ' ';
print '';
+ $rowspan=11;
+ if ($conf->global->USER_ALLOW_PASSWORD_CHANGE) $rowspan++;
+
print ''.$langs->trans("Lastname").' ';
print ' ';
- print '';
+ print ' ';
if (file_exists($conf->users->dir_output."/".$fuser->id.".jpg"))
{
print ' ';
@@ -696,21 +721,21 @@ else
print " ".''.$langs->trans("Firstname").' ';
print ' ';
+ // Login
print "".''.$langs->trans("Login").' ';
- print ' ';
-
- print "".''.$langs->trans("Phone").' ';
- print ' ';
-
- print "".''.$langs->trans("Fax").' ';
- print ' ';
-
- print "".''.$langs->trans("Mobile").' ';
- print ' ';
-
- print "".''.$langs->trans("EMail").' ';
- print ' ';
+ print '';
+ if ($user->admin) print ' ';
+ else print $fuser->login.' ';
+ print ' ';
+ // Pass
+ if ($conf->global->USER_ALLOW_PASSWORD_CHANGE)
+ {
+ print "".''.$langs->trans("Password").' ';
+ print ' ';
+ }
+
+ // Administrateur
print "".''.$langs->trans("Administrator").' ';
if ($fuser->societe_id > 0)
{
@@ -725,8 +750,56 @@ else
print ' ';
}
+ // Source
+ print ''.$langs->trans("Source").' ';
+ print '';
+ if ($fuser->societe_id)
+ {
+ print $langs->trans("External");
+ }
+ else
+ {
+ print $langs->trans("Internal");
+ }
+ print ' ';
+
+ // Company / Contact
+ print ''.$langs->trans("Company").' / '.$langs->trans("Contact").' ';
+ print '';
+ if ($fuser->societe_id > 0)
+ {
+ $societe = new Societe($db);
+ $societe->fetch($fuser->societe_id);
+ print ''.img_object($langs->trans("ShowCompany"),'company').' '.dolibarr_trunc($societe->nom,32).' ';
+ if ($fuser->contact_id)
+ {
+ $contact = new Contact($db);
+ $contact->fetch($fuser->contact_id);
+ print ' / '.''.img_object($langs->trans("ShowContact"),'contact').' '.dolibarr_trunc($contact->fullname,32).' ';
+ }
+ }
+ else
+ {
+ print $langs->trans("ThisUserIsNot");
+ }
+ print ' ';
+ print " \n";
+
+ // Tel, fax, portable
+ print "".''.$langs->trans("Phone").' ';
+ print ' ';
+
+ print "".''.$langs->trans("Fax").' ';
+ print ' ';
+
+ print "".''.$langs->trans("Mobile").' ';
+ print ' ';
+
+ print "".''.$langs->trans("EMail").' ';
+ print ' ';
+
print "".''.$langs->trans("Note").' ';
- print '';
+ print '';
print $fuser->note;
print " ";
@@ -737,10 +810,11 @@ else
print ' ';
- print '
';
+ print '';
print ' ';
}
+ print '
';
}
}
diff --git a/htdocs/user/home.php b/htdocs/user/home.php
index 807327151a4..2553283a78e 100644
--- a/htdocs/user/home.php
+++ b/htdocs/user/home.php
@@ -116,7 +116,7 @@ if ($resql)
{
print ''.img_object($langs->trans("ShowCompany"),"company").' '.$obj->nom.' ';
}
- else print ' ';
+ else print $langs->trans("InternalUser");
print '';
print "".dolibarr_print_date($obj->datec)." ";
print '';
diff --git a/htdocs/user/index.php b/htdocs/user/index.php
index f0d47396f72..8c3080074fa 100644
--- a/htdocs/user/index.php
+++ b/htdocs/user/index.php
@@ -51,14 +51,17 @@ llxHeader();
print_titre($langs->trans("ListOfUsers"));
-$sql = "SELECT u.rowid, u.name, u.firstname, u.admin, u.code, u.login, ".$db->pdate("u.datec")." as datec";
-$sql .= " FROM ".MAIN_DB_PREFIX."user as u";
-$sql .= " WHERE 1=1";
-if ($_POST["search_user"]) {
- $sql .= " AND (u.name like '%".$_POST["search_user"]."%' OR u.firstname like '%".$_POST["search_user"]."%')";
+$sql = "SELECT u.rowid, u.name, u.firstname, u.admin, u.code, u.fk_societe, u.login, ".$db->pdate("u.datec")." as datec,";
+$sql.= " s.nom";
+$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
+$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON u.fk_societe = s.idp";
+$sql.= " WHERE 1=1";
+if ($_POST["search_user"])
+{
+ $sql.= " AND (u.name like '%".$_POST["search_user"]."%' OR u.firstname like '%".$_POST["search_user"]."%')";
}
if ($sall) $sql.= " AND (u.login like '%".$sall."%' OR u.name like '%".$sall."%' OR u.firstname like '%".$sall."%' OR u.code like '%".$sall."%' OR u.email like '%".$sall."%' OR u.note like '%".$sall."%')";
-if ($sortfield) { $sql.=" ORDER BY $sortfield $sortorder"; }
+if ($sortfield) $sql.=" ORDER BY $sortfield $sortorder";
$result = $db->query($sql);
if ($result)
@@ -75,6 +78,7 @@ if ($result)
print_liste_field_titre($langs->trans("Lastname"),"index.php","u.name",$param,"","",$sortfield);
print_liste_field_titre($langs->trans("Firstname"),"index.php","u.firstname",$param,"","",$sortfield);
print_liste_field_titre($langs->trans("Code"),"index.php","u.code",$param,"","",$sortfield);
+ print_liste_field_titre($langs->trans("Company"),"index.php","u.fk_societe",$param,"","",$sortfield);
print_liste_field_titre($langs->trans("DateCreation"),"index.php","u.datec",$param,"","",$sortfield);
print "\n";
$var=True;
@@ -105,6 +109,13 @@ if ($result)
print ''.ucfirst($obj->name).' ';
print ''.ucfirst($obj->firstname).' ';
print ''.$obj->code.' ';
+ print "";
+ if ($obj->fk_societe)
+ {
+ print ''.img_object($langs->trans("ShowCompany"),"company").' '.$obj->nom.' ';
+ }
+ else print $langs->trans("InternalUser");
+ print ' ';
print ''.dolibarr_print_date($obj->datec,"%d %b %Y").' ';
print "\n";
$i++;