* Copyright (C) 2002-2003 Jean-Louis Bergamo * Copyright (C) 2004-2006 Laurent Destailleur * Copyright (C) 2004 Eric Seigne * Copyright (C) 2005-2006 Regis Houssin * Copyright (C) 2005 Lionel COUSTEIX * * 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/fiche.php \brief Onglet user et permissions de la fiche utilisateur \version $Revision$ */ require("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT."/contact.class.php"); require_once(DOL_DOCUMENT_ROOT."/lib/ldap.class.php"); require_once(DOL_DOCUMENT_ROOT."/lib/usergroups.lib.php"); // Defini si peux creer un utilisateur ou gerer groupe sur un utilisateur $canadduser=($user->admin || $user->rights->user->user->creer); // Defini si peux lire/modifier permisssions $canreadperms=($user->admin || $user->rights->user->user->lire); $caneditperms=($user->admin || $user->rights->user->user->creer); $candisableperms=($user->admin || $user->rights->user->user->supprimer); // Defini si peux lire/modifier info user ou mot de passe if ($_GET["id"]) { // $user est le user qui edite, $_GET["id"] est l'id de l'utilisateur edité $caneditfield=( (($user->id == $_GET["id"]) && $user->rights->user->self->creer) || (($user->id != $_GET["id"]) && $user->rights->user->user->creer) ); $caneditpassword=( (($user->id == $_GET["id"]) && $user->rights->user->self->password) || (($user->id != $_GET["id"]) && $user->rights->user->user->password) ); } if ($user->id <> $_GET["id"] && ! $canreadperms) { accessforbidden(); } $langs->load("users"); $langs->load("companies"); $langs->load("ldap"); $action=isset($_GET["action"])?$_GET["action"]:$_POST["action"]; $form = new Form($db); /** * Actions */ if ($_GET["subaction"] == 'addrights' && $caneditperms) { $edituser = new User($db,$_GET["id"]); $edituser->addrights($_GET["rights"]); } if ($_GET["subaction"] == 'delrights' && $caneditperms) { $edituser = new User($db,$_GET["id"]); $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->setstatus(0); Header("Location: ".DOL_URL_ROOT.'/user/fiche.php?id='.$_GET["id"]); exit; } } if ($_POST["action"] == 'confirm_enable' && $_POST["confirm"] == "yes") { if ($_GET["id"] <> $user->id) { $edituser = new User($db, $_GET["id"]); $edituser->fetch($_GET["id"]); $edituser->setstatus(1); Header("Location: ".DOL_URL_ROOT.'/user/fiche.php?id='.$_GET["id"]); exit; } } if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == "yes") { if ($_GET["id"] <> $user->id) { $edituser = new User($db, $_GET["id"]); $edituser->id=$_GET["id"]; $edituser->delete(); Header("Location: index.php"); exit; } } // Action ajout user if ($_POST["action"] == 'add' && $canadduser) { $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); $edituser->nom = trim($_POST["nom"]); $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->webcal_login = trim($_POST["webcal_login"]); $edituser->note = trim($_POST["note"]); $edituser->ldap_sid = trim($_POST["ldap_sid"]); $db->begin(); $id = $edituser->create($user); if ($id > 0) { if (isset($_POST['password']) && trim($_POST['password'])) { $edituser->password($user,trim($_POST['password']),$conf->password_encrypted); } $db->commit(); Header("Location: fiche.php?id=$id"); exit; } else { $db->rollback(); //$message='
'.$langs->trans("ErrorLoginAlreadyExists",$edituser->login).'
'; $message='
'.$edituser->error.'
'; $action="create"; // Go back to create page } } } // Action ajout groupe utilisateur if ($_POST["action"] == 'addgroup' && $caneditfield) { if ($_POST["group"]) { $edituser = new User($db, $_GET["id"]); $edituser->SetInGroup($_POST["group"]); Header("Location: fiche.php?id=".$_GET["id"]); exit; } } if ($_GET["action"] == 'removegroup' && $caneditfield) { if ($_GET["group"]) { $edituser = new User($db, $_GET["id"]); $edituser->RemoveFromGroup($_GET["group"]); Header("Location: fiche.php?id=".$_GET["id"]); exit; } } if ($_POST["action"] == 'update' && ! $_POST["cancel"] && $caneditfield) { $message=""; if (! $_POST["nom"]) { $message='
'.$langs->trans("NameNotDefined").'
'; $action="edit"; // Go back to create page } if (! $_POST["login"]) { $message='
'.$langs->trans("LoginNotDefined").'
'; $action="edit"; // Go back to create page } if (! $message) { $db->begin(); $edituser = new User($db, $_GET["id"]); $edituser->fetch(); //$edituser->oldpass_indatabase = $edituser->pass_indatabase; $edituser->nom = trim($_POST["nom"]); $edituser->prenom = trim($_POST["prenom"]); $edituser->login = trim($_POST["login"]); $edituser->pass = trim($_POST["pass"]); $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->note = trim($_POST["note"]); $edituser->webcal_login = trim($_POST["webcal_login"]); $ret=$edituser->update(); if ($ret < 0) { if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $message.='
'.$langs->trans("ErrorLoginAlreadyExists",$edituser->login).'
'; } else { $message.='
'.$edituser->error.'
'; } } if ($ret >= 0 && isset($_POST["password"]) && $_POST["password"] !='') { $ret=$edituser->password($user,$_POST["password"],$conf->password_encrypted,1); if ($ret < 0) { $message.='
'.$edituser->error.'
'; } } if (isset($_FILES['photo']['tmp_name']) && trim($_FILES['photo']['tmp_name'])) { // Si une photo est fournie avec le formulaire if (! is_dir($conf->users->dir_output)) { create_exdir($conf->users->dir_output); } if (is_dir($conf->users->dir_output)) { $newfile=$conf->users->dir_output . "/" . $edituser->id . ".jpg"; if (! doliMoveFileUpload($_FILES['photo']['tmp_name'],$newfile)) { $message .= '
'.$langs->trans("ErrorFailedToSaveFile").'
'; } } } if ($ret >= 0) { $message.='
'.$langs->trans("UserModified").'
'; $db->commit(); } else { $db->rollback(); } } } // Action modif mot de passe if ((($_POST["action"] == 'confirm_password' && $_POST["confirm"] == 'yes') || $_GET["action"] == 'confirm_passwordsend') && $caneditpassword) { $edituser = new User($db, $_GET["id"]); $edituser->fetch(); $newpassword=$edituser->password($user,'',$conf->password_encrypted); if ($newpassword < 0) { // Echec $message = '
'.$langs->trans("ErrorFailedToSaveFile").'
'; } else { // Succes if ($_GET["action"] == 'confirm_passwordsend') { if ($edituser->send_password($user,$newpassword) > 0) { $message = '
'.$langs->trans("PasswordChangedAndSentTo",$edituser->email).'
'; //$message.=$newpassword; } else { $message = '
'.$langs->trans("PasswordChangedTo",$newpassword).'
'; $message.= '
'.$edituser->error.'
'; } } else { $message = '
'.$langs->trans("PasswordChangedTo",$newpassword).'
'; } } } // Action initialisation donnees depuis record LDAP if ($_POST["action"] == 'adduserldap') { $selecteduser = $_POST['users']; $justthese = array( $conf->global->LDAP_FIELD_NAME, $conf->global->LDAP_FIELD_FIRSTNAME, $conf->global->LDAP_FIELD_UID, $conf->global->LDAP_FIELD_LOGIN_SAMBA, $conf->global->LDAP_FIELD_MAIL, $conf->global->LDAP_FIELD_PHONE, $conf->global->LDAP_FIELD_FAX, $conf->global->LDAP_FIELD_MOBILE, $conf->global->LDAP_FIELD_SID); $ldap = new Ldap(); $result = $ldap->connect_bind(); if ($result >= 0) { $ldapusers = $ldap->getUsers($selecteduser, $conf->global->LDAP_USER_DN, $conf->global->LDAP_KEY_USERS, $justthese); if (is_array($ldapusers)) { foreach ($ldapusers as $key => $attribute) { $ldap_nom = $attribute[$conf->global->LDAP_FIELD_NAME]; $ldap_prenom = $attribute[$conf->global->LDAP_FIELD_FIRSTNAME]; $ldap_login = $attribute[$conf->global->LDAP_FIELD_LOGIN]; $ldap_loginsmb = $attribute[$conf->global->LDAP_FIELD_LOGIN_SAMBA]; $ldap_phone = $attribute[$conf->global->LDAP_FIELD_PHONE]; $ldap_fax = $attribute[$conf->global->LDAP_FIELD_FAX]; $ldap_mobile = $attribute[$conf->global->LDAP_FIELD_MOBILE]; $ldap_mail = $attribute[$conf->global->LDAP_FIELD_MAIL]; $ldap_sid = $attribute[$conf->global->LDAP_FIELD_SID]; } } } else { $message='
'.$ldap->error.'
'; } } /* * Affichage page */ llxHeader('',$langs->trans("UserCard")); $html = new Form($db); if (($action == 'create') || ($action == 'adduserldap')) { /* ************************************************************************** */ /* */ /* Affichage fiche en mode création */ /* */ /* ************************************************************************** */ print_titre($langs->trans("NewUser")); print "
"; print $langs->trans("CreateInternalUserDesc"); print "
"; print "
"; if ($message) { print $message.'
'; } if ($conf->ldap->enabled && $conf->global->LDAP_SYNCHRO_ACTIVE == 'ldap2dolibarr') { /* * Affiche formulaire d'ajout d'un compte depuis LDAP * si on est en synchro LDAP vers Dolibarr */ print "\n\n\n"; print '
'; $ldap = new Ldap(); $result = $ldap->connect_bind(); if ($result >= 0) { $justthese=array($conf->global->LDAP_KEY_USERS, $conf->global->LDAP_FIELD_FULLNAME, $conf->global->LDAP_FIELD_NAME, $conf->global->LDAP_FIELD_FIRSTNAME, $conf->global->LDAP_FIELD_LOGIN, $conf->global->LDAP_FIELD_LOGIN_SAMBA); $ldapusers = $ldap->getUsers('*', $conf->global->LDAP_USER_DN, $conf->global->LDAP_KEY_USERS, $justthese, 1); if (is_array($ldapusers)) { $liste=array(); foreach ($ldapusers as $key => $ldapuser) { $record=''; foreach ($justthese as $value) { if ($value) { $record.=$value."=".$ldapuser[$value]." "; } } $liste[$key] = $record; } print '
'; print ''; print '
'; print $langs->trans("LDAPUsers"); print ''; print ''; print $html->select_array('users', $liste, '', 1); print ''; print ''; print '
'; print '
'; } else { $message='
'.$ldap->error.'
'; } } else { $message='
'.$ldap->error.'
'; } print "
"; print "\n\n\n"; print '
'; } print '
'; print ''; if ($ldap_sid) print ''; print ''; // Nom print "".''; print ''; // Prenom print ''; print ''; // Login print ''; print ''; if (!$ldap_sid) { $generated_password=''; if ($conf->global->USER_PASSWORD_GENERATED) { $nomclass="modGeneratePass".ucfirst($conf->global->USER_PASSWORD_GENERATED); $nomfichier=$nomclass.".class.php"; //print DOL_DOCUMENT_ROOT."/includes/modules/security/generate/".$nomclass; require_once(DOL_DOCUMENT_ROOT."/includes/modules/security/generate/".$nomfichier); $genhandler=new $nomclass($db,$conf,$lang,$user); $generated_password=$genhandler->getNewGeneratedPassword(); } } // Mot de passe print ''; print ''; // Administrateur if ($user->admin) { print ''; print '\n"; } // Type print ''; print ''; // Tel print ''; print ''; // Fax print ''; print ''; // Tel portable print ''; print ''; // EMail print ''; print ''; // Note print '\n"; // Autres caractéristiques issus des autres modules if ($conf->webcal->enabled) { print "".''; print ''; } print "".''; print "
'.$langs->trans("Lastname").'*'; if ($ldap_nom) { print ''; print $ldap_nom; } else { print ''; } print '
'.$langs->trans("Firstname").''; if ($ldap_prenom) { print ''; print $ldap_prenom; } else { print ''; } print '
'.$langs->trans("Login").'*'; if ($ldap_login) { print ''; print $ldap_login; } elseif ($ldap_loginsmb) { print ''; print $ldap_loginsmb; } else { print ''; } print '
'.$langs->trans("Password").''; if ($ldap_sid) { print 'mot de passe du domaine'; } else { print ''; } print '
'.$langs->trans("Administrator").''; $form->selectyesnonum('admin',0); print "
'.$langs->trans("Type").''; print $html->textwithhelp($langs->trans("Internal"),$langs->trans("InternalExternalDesc")); print '
'.$langs->trans("Phone").''; if ($ldap_phone) { print ''; print $ldap_phone; } else { print ''; } print '
'.$langs->trans("Fax").''; if ($ldap_fax) { print ''; print $ldap_fax; } else { print ''; } print '
'.$langs->trans("Mobile").''; if ($ldap_mobile) { print ''; print $ldap_mobile; } else { print ''; } print '
'.$langs->trans("EMail").''; if ($ldap_mail) { print ''; print $ldap_mail; } else { print ''; } print '
'; print $langs->trans("Note"); print ''; if ($conf->fckeditor->enabled) { require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php"); $doleditor=new DolEditor('note','',180,'dolibarr_notes','',false); $doleditor->Create(); } else { print ''; } print "
'.$langs->trans("LoginWebcal").'
\n"; print "
"; } else { /* ************************************************************************** */ /* */ /* Visu et edition */ /* */ /* ************************************************************************** */ if ($_GET["id"]) { $fuser = new User($db, $_GET["id"]); $fuser->fetch(); // Connexion ldap // pour recuperer passDoNotExpire et userChangePassNextLogon if ($conf->ldap->enabled && $fuser->ldap_sid) { $ldap = new Ldap(); $result=$ldap->connect_bind(); if ($result > 0) { $entries = $ldap->fetch($fuser->login); if (! $entries) { $message .= $ldap->error; } //On vérifie les options du compte foreach ($ldap->uacf as $key => $statut) { if ($key == 65536) { $passDoNotExpire = $langs->trans("LdapUacf_".$statut); } } if ($ldap->pwdlastset == 0 && $ldap->pwdlastset != "") { $userChangePassNextLogon = $langs->trans("UserMustChangePassNextLogon"); } } } /* * Affichage onglets */ $head = user_prepare_head($fuser); dolibarr_fiche_head($head, 'user', $langs->trans("User").": ".$fuser->fullname); /* * Confirmation réinitialisation mot de passe */ if ($action == 'password') { $html->form_confirm("fiche.php?id=$fuser->id",$langs->trans("ReinitPassword"),$langs->trans("ConfirmReinitPassword",$fuser->login),"confirm_password"); print '
'; } /* * Confirmation envoi mot de passe */ if ($action == 'passwordsend') { $html->form_confirm("fiche.php?id=$fuser->id",$langs->trans("SendNewPassword"),$langs->trans("ConfirmSendNewPassword",$fuser->login),"confirm_passwordsend"); print '
'; } /* * Confirmation désactivation */ if ($action == 'disable') { $html->form_confirm("fiche.php?id=$fuser->id",$langs->trans("DisableAUser"),$langs->trans("ConfirmDisableUser",$fuser->login),"confirm_disable"); print '
'; } /* * Confirmation activation */ if ($action == 'enable') { $html->form_confirm("fiche.php?id=$fuser->id",$langs->trans("EnableAUser"),$langs->trans("ConfirmEnableUser",$fuser->login),"confirm_enable"); print '
'; } /* * Confirmation suppression */ if ($action == 'delete') { $html->form_confirm("fiche.php?id=$fuser->id",$langs->trans("DeleteAUser"),$langs->trans("ConfirmDeleteUser",$fuser->login),"confirm_delete"); print '
'; } /* * Fiche en mode visu */ if ($_GET["action"] != 'edit') { print ''; $rowspan=17; // Ref print ''; print ''; print ''; // Nom print ''; print ''; print "\n"; // Prenom print ''; print ''; print "\n"; // Login print ''; if ($fuser->ldap_sid) { print ''; } else { print ''; } print ''; // Password print ''; if ($fuser->ldap_sid) { if ($passDoNotExpire) { print ''; } else if($userChangePassNextLogon) { print ''; } else { print ''; } } else { print '"; } print "\n"; // Administrateur print ''; print ''; print "\n"; // Type print ''; print ''; // Company / Contact print ''; print ''; print "\n"; // Tel, fax, portable print ''; print ''; print ''; print ''; print ''; print ''; // EMail print ''; print ''; print "\n"; // Statut print ''; print ''; print ''; print ''; print "\n"; print ''; print ''; print "\n"; print ''; print ''; print "\n"; print ''; print ''; print "\n"; // Note print "".''; print ''; print "\n"; // Autres caractéristiques issus des autres modules if ($conf->webcal->enabled) { $langs->load("other"); print ''; print ''; print "\n"; } print "
'.$langs->trans("Ref").''; if ($previous_ref || $next_ref) print '
'; print $fuser->id; if ($previous_ref || $next_ref) print ''.$previous_ref.''.$next_ref.'
'; print '
'; if (file_exists($conf->users->dir_output."/".$fuser->id.".jpg")) { print ''; } else { print ''; } print '
'.$langs->trans("Lastname").''.$fuser->nom.'
'.$langs->trans("Firstname").''.$fuser->prenom.'
'.$langs->trans("Login").''.$langs->trans("LoginAccountDisableInDolibarr").''.$fuser->login.'
'.$langs->trans("Password").''.$passDoNotExpire.''.$userChangePassNextLogon.''.$langs->trans("DomainPassword").''; if ($fuser->pass) print eregi_replace('.','*',$fuser->pass); else { if ($user->admin) print $langs->trans("Crypted").': '.$fuser->pass_indatabase; else print $langs->trans("Hidden"); } print "
'.$langs->trans("Administrator").''.yn($fuser->admin); if ($fuser->admin) print ' '.img_picto($langs->trans("Administrator"),"star"); print '
'.$langs->trans("Type").''; if ($fuser->societe_id) { print $html->textwithhelp($langs->trans("External"),$langs->trans("InternalExternalDesc")); } else if ($fuser->ldap_sid) { print $langs->trans("DomainUser"); } else { print $html->textwithhelp($langs->trans("Internal"),$langs->trans("InternalExternalDesc")); } print '
'.$langs->trans("Company").' / '.$langs->trans("Contact").''; 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 '
'.$langs->trans("Phone").''.$fuser->office_phone.'
'.$langs->trans("Fax").''.$fuser->office_fax.'
'.$langs->trans("Mobile").''.$fuser->user_mobile.'
'.$langs->trans("EMail").''.$fuser->email.'
'.$langs->trans("Status").''; print $fuser->getLibStatut(4); print '
'.$langs->trans("DateCreation").''.dolibarr_print_date($fuser->datec,"%d/%m/%Y %H:%M:%S").'
'.$langs->trans("DateModification").''.dolibarr_print_date($fuser->datem,"%d/%m/%Y %H:%M:%S").'
'.$langs->trans("LastConnexion").''.dolibarr_print_date($fuser->datelastlogin,"%d/%m/%Y %H:%M:%S").'
'.$langs->trans("PreviousConnexion").''.dolibarr_print_date($fuser->datepreviouslogin,"%d/%m/%Y %H:%M:%S").'
'.$langs->trans("Note").''.nl2br($fuser->note).' 
'.$langs->trans("LoginWebcal").''.$fuser->webcal_login.' 
\n"; print "\n"; if ($message) { print $message; } /* * Barre d'actions */ print '
'; if ($caneditfield) { print ''.$langs->trans("Edit").''; } elseif ($caneditpassword && ! $fuser->ldap_sid) { print ''.$langs->trans("EditPassword").''; } // Si on a un gestionnaire de generation de mot de passe actif if ($conf->global->USER_PASSWORD_GENERATED != 'none') { if (($user->id != $_GET["id"] && $caneditpassword) && $fuser->login && !$fuser->ldap_sid) { print ''.$langs->trans("ReinitPassword").''; } if (($user->id != $_GET["id"] && $caneditpassword) && $fuser->email && $fuser->login && !$fuser->ldap_sid) { print ''.$langs->trans("SendNewPassword").''; } } // Activer if ($user->id <> $_GET["id"] && $candisableperms && $fuser->statut == 0) { print ''.$langs->trans("Reactivate").''; } // Desactiver if ($user->id <> $_GET["id"] && $candisableperms && $fuser->statut == 1) { print ''.$langs->trans("DisableUser").''; } if ($user->id <> $_GET["id"] && $candisableperms) { print ''.$langs->trans("DeleteUser").''; } print "
\n"; print "
\n"; /* * Liste des groupes dans lequel est l'utilisateur */ print_fiche_titre($langs->trans("ListOfGroupsForUser")); // On sélectionne les groups $uss = array(); $sql = "SELECT ug.rowid, ug.nom "; $sql .= " FROM ".MAIN_DB_PREFIX."usergroup as ug "; # $sql .= " LEFT JOIN llx_usergroup_user ug ON u.rowid = ug.fk_user"; # $sql .= " WHERE ug.fk_usergroup IS NULL"; $sql .= " ORDER BY ug.nom"; $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); $i = 0; while ($i < $num) { $obj = $db->fetch_object($resql); $uss[$obj->rowid] = $obj->nom; $i++; } } else { dolibarr_print_error($db); } if ($caneditperms) { $form = new Form($db); print '
'."\n"; print ''; print ''."\n"; // print ''."\n"; print ''."\n"; print ''."\n"; print '
'.$langs->trans("NonAffectedUsers").'
'.$langs->trans("GroupsToAdd").''; print $form->select_array("group",$uss); print '   '; print ''; print '
'."\n"; print '
'; } /* * Groupes affectés */ $sql = "SELECT g.rowid, g.nom "; $sql .= " FROM ".MAIN_DB_PREFIX."usergroup as g"; $sql .= ",".MAIN_DB_PREFIX."usergroup_user as ug"; $sql .= " WHERE ug.fk_usergroup = g.rowid"; $sql .= " AND ug.fk_user = ".$_GET["id"]; $sql .= " ORDER BY g.nom"; $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); $i = 0; print ''; print ''; print ''; print "\n"; if ($num) { $var=True; while ($i < $num) { $obj = $db->fetch_object($result); $var=!$var; print ""; print ''; print '\n"; $i++; } } else { print ''; } print "
'.$langs->trans("Group").' 
'; print ''.img_object($langs->trans("ShowGroup"),"group").' '.$obj->nom.''; print ''; if ($caneditperms) { print 'rowid.'">'; print img_delete($langs->trans("RemoveFromGroup")); } else { print "-"; } print "
'.$langs->trans("None").'
"; print "
"; $db->free($result); } else { dolibarr_print_error($db); } } /* * Fiche en mode edition */ if ($_GET["action"] == 'edit' && (($caneditperms && (!$fuser->ldap_sid || !$fuser->login)) || ($user->id == $fuser->id))) { print '
'; print ''; print ''; $rowspan=13; print ''; print ''; print ''; // Nom print "".''; print ''; // Prenom print "".''; print ''; // Login print "".''; print ''; // Pass print ''; if ($fuser->ldap_sid) { print ''; } else if ($caneditpassword) { print ''; } else { print '\n"; // Administrateur print "".''; if ($fuser->societe_id > 0) { print ''; } else { print ''; } // Type print ''; print ''; // Company / Contact print ''; print ''; print "\n"; // Tel, fax, portable print "".''; print ''; print "".''; print ''; print "".''; print ''; // EMail print "".''; print ''; // Statut print ''; print ''; // Note print ''; // Autres caractéristiques issus des autres modules if ($conf->webcal->enabled) { $langs->load("other"); print "".''; print ''; } print ''; print '
'.$langs->trans("Ref").''; print $fuser->id; print ''; if (file_exists($conf->users->dir_output."/".$fuser->id.".jpg")) { print ''; } else { print ''; } if ($caneditfield) { print '

'; print '
'.$langs->trans("PhotoFile").'
'; print ''; print '
'; } print '
'.$langs->trans("Name").'*'; if ($caneditfield) print ''; else print $fuser->nom; print '
'.$langs->trans("Firstname").''; if ($caneditfield) print ''; else print $fuser->prenom; print '
'.$langs->trans("Login").'*'; if ($user->admin) print ''; else print $fuser->login.''; print '
'.$langs->trans("Password").'Mot de passe du domaine'.eregi_replace('.','*',$fuser->pass); } print "
'.$langs->trans("Administrator").''; print ''.yn($fuser->admin); print '
'; if ($user->admin) { $form->selectyesnonum('admin',$fuser->admin); } else { print ''.yn($fuser->admin); } print '
'.$langs->trans("Type").''; if ($fuser->societe_id) { print $langs->trans("External"); } else if ($fuser->ldap_sid) { print $langs->trans("DomainUser"); } else { print $langs->trans("Internal"); } print '
'.$langs->trans("Company").' / '.$langs->trans("Contact").''; 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 '
'.$langs->trans("Phone").''; if ($caneditfield) print ''; else print $fuser->office_phone; print '
'.$langs->trans("Fax").''; if ($caneditfield) print ''; else print $fuser->office_fax; print '
'.$langs->trans("Mobile").''; if ($caneditfield) print ''; else print $fuser->user_mobile; print '
'.$langs->trans("EMail").''; if ($caneditfield) print ''; else print $fuser->email; print '
'.$langs->trans("Status").''; print $fuser->getLibStatut(4); print '
'.$langs->trans("Note").''; if ($caneditfield) { if ($conf->fckeditor->enabled) { require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php"); $doleditor=new DolEditor('note',$fuser->note,180,'dolibarr_notes','',false); $doleditor->Create(); } else { print ''; } } else { print nl2br($fuser->note); } print '
'.$langs->trans("LoginWebcal").''; if ($caneditfield) print ''; else print $fuser->webcal_login; print '
'; print ''; print '   '; print ''; print '
'; print '
'; print ''; } $ldap->close; } } $db->close(); llxFooter('$Date$ - $Revision$'); ?>