';
print '';
@@ -485,13 +487,13 @@ if (($action == 'create') || ($action == 'adduserldap'))
print ' ';
}
}
-
+
print '";
}
else
{
- /* ************************************************************************** */
- /* */
- /* Visu et edition */
- /* */
- /* ************************************************************************** */
+ /* ************************************************************************** */
+ /* */
+ /* Visu et edition */
+ /* */
+ /* ************************************************************************** */
- if ($_GET["id"])
- {
- $fuser = new User($db, $_GET["id"]);
- $fuser->fetch();
+ 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;
- }
-
- $passDoNotExpire = 0;
- $userChangePassNextLogon = 0;
- $userDisabled = 0;
- $statutUACF = '';
+ // 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;
+ }
+
+ $passDoNotExpire = 0;
+ $userChangePassNextLogon = 0;
+ $userDisabled = 0;
+ $statutUACF = '';
- //On verifie les options du compte
- if (sizeof($ldap->uacf) > 0)
- {
- foreach ($ldap->uacf as $key => $statut)
- {
- if ($key == 65536)
- {
- $passDoNotExpire = 1;
- $statutUACF = $statut;
- }
- }
- }
- else
- {
- $userDisabled = 1;
- $statutUACF = "ACCOUNTDISABLE";
- }
-
- if ($ldap->pwdlastset == 0)
- {
- $userChangePassNextLogon = 1;
- }
- }
- }
+ //On verifie les options du compte
+ if (sizeof($ldap->uacf) > 0)
+ {
+ foreach ($ldap->uacf as $key => $statut)
+ {
+ if ($key == 65536)
+ {
+ $passDoNotExpire = 1;
+ $statutUACF = $statut;
+ }
+ }
+ }
+ else
+ {
+ $userDisabled = 1;
+ $statutUACF = "ACCOUNTDISABLE";
+ }
+
+ if ($ldap->pwdlastset == 0)
+ {
+ $userChangePassNextLogon = 1;
+ }
+ }
+ }
/*
* Affichage onglets
*/
$head = user_prepare_head($fuser);
-
+
dolibarr_fiche_head($head, 'user', $langs->trans("User"));
- /*
- * Confirmation reinitialisation 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 reinitialisation 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 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 desactivation
- */
- if ($action == 'disable')
- {
- $html->form_confirm("fiche.php?id=$fuser->id",$langs->trans("DisableAUser"),$langs->trans("ConfirmDisableUser",$fuser->login),"confirm_disable");
- print ' ';
- }
+ /*
+ * Confirmation desactivation
+ */
+ 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 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 ' ';
- }
+ /*
+ * 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 '';
+ /*
+ * Fiche en mode visu
+ */
+ if ($_GET["action"] != 'edit')
+ {
+ print '';
- // Ref
- print '| '.$langs->trans("Ref").' | ';
- print '';
+ // Ref
+ print ' | | '.$langs->trans("Ref").' | ';
+ print '';
print $html->showrefnav($fuser,'id','',$user->rights->user->user->lire || $user->admin);
print ' | ';
print ' ';
- // Nom
- print '| '.$langs->trans("Lastname").' | ';
- print ''.$fuser->nom.' | ';
- print " \n";
+ // Nom
+ print '| '.$langs->trans("Lastname").' | ';
+ print ''.$fuser->nom.' | ';
+ print " \n";
- // Prenom
- print '| '.$langs->trans("Firstname").' | ';
- print ''.$fuser->prenom.' | ';
- print " \n";
+ // Prenom
+ print '| '.$langs->trans("Firstname").' | ';
+ print ''.$fuser->prenom.' | ';
+ print " \n";
- $rowspan=12;
+ $rowspan=12;
// Login
- print '| '.$langs->trans("Login").' | ';
- if ($fuser->ldap_sid && $fuser->statut==0)
- {
- print ''.$langs->trans("LoginAccountDisableInDolibarr").' | ';
- }
- else
- {
- print ''.$fuser->login.' | ';
- }
- print '';
- if (file_exists($conf->users->dir_output."/".$fuser->id.".jpg"))
- {
- print ' ';
- }
- else
- {
- print ' ';
- }
- print ' | ';
- print ' ';
-
- // Password
- print '| '.$langs->trans("Password").' | ';
- if ($fuser->ldap_sid)
- {
- if ($passDoNotExpire)
- {
- print ''.$langs->trans("LdapUacf_".$statutUACF).' | ';
- }
- else if($userChangePassNextLogon)
- {
- print ''.$langs->trans("UserMustChangePassNextLogon",$ldap->domainFQDN).' | ';
- }
- else if($userDisabled)
- {
- print ''.$langs->trans("LdapUacf_".$statutUACF,$ldap->domainFQDN).' | ';
- }
- else
- {
- print ''.$langs->trans("DomainPassword").' | ';
- }
- }
- else
- {
- print '';
- if ($fuser->pass) print eregi_replace('.','*',$fuser->pass);
- else
- {
- if ($user->admin) print $langs->trans("Crypted").': '.$fuser->pass_indatabase_crypted;
- else print $langs->trans("Hidden");
- }
- print " | ";
- }
- print " \n";
-
- // Administrateur
- print '| '.$langs->trans("Administrator").' | ';
- print ''.yn($fuser->admin);
- if ($fuser->admin) print ' '.img_picto($langs->trans("Administrator"),"star");
- print ' | ';
- print " \n";
-
- // Type
- print '| '.$langs->trans("Type").' | ';
- print '';
- if ($fuser->societe_id)
- {
- print $html->textwithhelp($langs->trans("External"),$langs->trans("InternalExternalDesc"));
- }
- else if ($fuser->ldap_sid)
- {
- print $langs->trans("DomainUser",$ldap->domainFQDN);
- }
- else
- {
- print $html->textwithhelp($langs->trans("Internal"),$langs->trans("InternalExternalDesc"));
- }
- 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).'';
- }
- else
- {
- print $langs->trans("ThisUserIsNot");
- }
- if ($fuser->contact_id)
- {
- $contact = new Contact($db);
- $contact->fetch($fuser->contact_id);
- if ($fuser->societe_id > 0) print ' / ';
- else print ' ';
- print ''.img_object($langs->trans("ShowContact"),'contact').' '.dolibarr_trunc($contact->getFullName($langs),32).'';
- }
- print ' | ';
- print " \n";
-
- // Tel pro
- print '| '.$langs->trans("PhonePro").' | ';
- print ''.$fuser->office_phone.' | ';
-
- // Tel mobile
- print ' | '.$langs->trans("PhoneMobile").' | ';
- print ''.$fuser->user_mobile.' | ';
-
- // Fax
- print ' | '.$langs->trans("Fax").' | ';
- print ''.$fuser->office_fax.' | ';
-
- // EMail
- print ' | '.$langs->trans("EMail").' | ';
- print ''.$fuser->email.' | ';
- print " \n";
-
- // Statut
- print '| '.$langs->trans("Status").' | ';
- print '';
- print $fuser->getLibStatut(4);
- print ' | ';
-
- print '| '.$langs->trans("LastConnexion").' | ';
- print ''.dolibarr_print_date($fuser->datelastlogin,"dayhour").' | ';
- print " \n";
-
- print '| '.$langs->trans("PreviousConnexion").' | ';
- print ''.dolibarr_print_date($fuser->datepreviouslogin,"dayhour").' | ';
- print " \n";
-
- // Autres caracteristiques issus des autres modules
-
- // Module Webcalendar
- if ($conf->webcal->enabled)
- {
- $langs->load("other");
- print '| '.$langs->trans("LoginWebcal").' | ';
- print ''.$fuser->webcal_login.' | ';
- print " \n";
- }
-
- // Module Phenix
- if ($conf->phenix->enabled)
- {
- $langs->load("other");
- print '| '.$langs->trans("LoginPhenix").' | ';
- print ''.$fuser->phenix_login.' | ';
- print " \n";
- print '| '.$langs->trans("PassPhenix").' | ';
- print ''.eregi_replace('.','*',$fuser->phenix_pass_crypted).' | ';
- print " \n";
- }
-
- // Module Adherent
- if ($conf->adherent->enabled)
- {
- $langs->load("members");
- print '| '.$langs->trans("MemberAccount").' | ';
- print '';
- if ($fuser->fk_member)
- {
- $adh=new Adherent($db);
- $adh->fetch($fuser->fk_member);
- $adh->ref=$adh->login; // Force to show login instead of id
- print $adh->getNomUrl(1);
- }
- else
- {
- print $langs->trans("UserNotLinkedToMember");
- }
- print ' | ';
- print " \n";
- }
-
- print " \n";
-
- print "\n";
-
- if ($message) { print $message; }
-
-
- /*
- * Barre d'actions
- */
-
- print '';
-
-
- if ($caneditfield)
- {
- print ' '.$langs->trans("Modify").'';
- }
- 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')
+ print ' | '.$langs->trans("Login").' | ';
+ if ($fuser->ldap_sid && $fuser->statut==0)
{
- 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").'';
- }
+ print ''.$langs->trans("LoginAccountDisableInDolibarr").' | ';
+ }
+ else
+ {
+ print ''.$fuser->login.' | ';
+ }
+ print '';
+ if (file_exists($conf->users->dir_output."/".$fuser->id.".jpg"))
+ {
+ print ' ';
+ }
+ else
+ {
+ print ' ';
+ }
+ print ' | ';
+ print ' ';
+
+ // Password
+ print ' | '.$langs->trans("Password").' | ';
+ if ($fuser->ldap_sid)
+ {
+ if ($passDoNotExpire)
+ {
+ print ''.$langs->trans("LdapUacf_".$statutUACF).' | ';
+ }
+ else if($userChangePassNextLogon)
+ {
+ print ''.$langs->trans("UserMustChangePassNextLogon",$ldap->domainFQDN).' | ';
+ }
+ else if($userDisabled)
+ {
+ print ''.$langs->trans("LdapUacf_".$statutUACF,$ldap->domainFQDN).' | ';
+ }
+ else
+ {
+ print ''.$langs->trans("DomainPassword").' | ';
+ }
+ }
+ else
+ {
+ print '';
+ if ($fuser->pass) print eregi_replace('.','*',$fuser->pass);
+ else
+ {
+ if ($user->admin) print $langs->trans("Crypted").': '.$fuser->pass_indatabase_crypted;
+ else print $langs->trans("Hidden");
+ }
+ print " | ";
+ }
+ print " \n";
+
+ // Administrateur
+ print ' | '.$langs->trans("Administrator").' | ';
+ print ''.yn($fuser->admin);
+ if ($fuser->admin) print ' '.img_picto($langs->trans("Administrator"),"star");
+ print ' | ';
+ print " \n";
+
+ // Type
+ print ' | '.$langs->trans("Type").' | ';
+ print '';
+ if ($fuser->societe_id)
+ {
+ print $html->textwithhelp($langs->trans("External"),$langs->trans("InternalExternalDesc"));
+ }
+ else if ($fuser->ldap_sid)
+ {
+ print $langs->trans("DomainUser",$ldap->domainFQDN);
+ }
+ else
+ {
+ print $html->textwithhelp($langs->trans("Internal"),$langs->trans("InternalExternalDesc"));
+ }
+ 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).'';
+ }
+ else
+ {
+ print $langs->trans("ThisUserIsNot");
+ }
+ if ($fuser->contact_id)
+ {
+ $contact = new Contact($db);
+ $contact->fetch($fuser->contact_id);
+ if ($fuser->societe_id > 0) print ' / ';
+ else print ' ';
+ print ''.img_object($langs->trans("ShowContact"),'contact').' '.dolibarr_trunc($contact->getFullName($langs),32).'';
+ }
+ print ' | ';
+ print " \n";
+
+ // Tel pro
+ print ' | '.$langs->trans("PhonePro").' | ';
+ print ''.$fuser->office_phone.' | ';
+
+ // Tel mobile
+ print ' | '.$langs->trans("PhoneMobile").' | ';
+ print ''.$fuser->user_mobile.' | ';
+
+ // Fax
+ print ' | '.$langs->trans("Fax").' | ';
+ print ''.$fuser->office_fax.' | ';
+
+ // EMail
+ print ' | '.$langs->trans("EMail").' | ';
+ print ''.$fuser->email.' | ';
+ print " \n";
+
+ // Statut
+ print ' | '.$langs->trans("Status").' | ';
+ print '';
+ print $fuser->getLibStatut(4);
+ print ' | ';
+
+ print ' | '.$langs->trans("LastConnexion").' | ';
+ print ''.dolibarr_print_date($fuser->datelastlogin,"dayhour").' | ';
+ print " \n";
+
+ print ' | '.$langs->trans("PreviousConnexion").' | ';
+ print ''.dolibarr_print_date($fuser->datepreviouslogin,"dayhour").' | ';
+ print " \n";
+
+ // Autres caracteristiques issus des autres modules
+
+ // Module Webcalendar
+ if ($conf->webcal->enabled)
+ {
+ $langs->load("other");
+ print ' | '.$langs->trans("LoginWebcal").' | ';
+ print ''.$fuser->webcal_login.' | ';
+ print " \n";
}
- // 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").'';
- }
+ // Module Phenix
+ if ($conf->phenix->enabled)
+ {
+ $langs->load("other");
+ print ' | '.$langs->trans("LoginPhenix").' | ';
+ print ''.$fuser->phenix_login.' | ';
+ print " \n";
+ print ' | '.$langs->trans("PassPhenix").' | ';
+ print ''.eregi_replace('.','*',$fuser->phenix_pass_crypted).' | ';
+ print " \n";
+ }
- if ($user->id <> $_GET["id"] && $candisableperms)
- {
- print ' '.$langs->trans("DeleteUser").'';
- }
+ // Module Adherent
+ if ($conf->adherent->enabled)
+ {
+ $langs->load("members");
+ print ' | '.$langs->trans("MemberAccount").' | ';
+ print '';
+ if ($fuser->fk_member)
+ {
+ $adh=new Adherent($db);
+ $adh->fetch($fuser->fk_member);
+ $adh->ref=$adh->login; // Force to show login instead of id
+ print $adh->getNomUrl(1);
+ }
+ else
+ {
+ print $langs->trans("UserNotLinkedToMember");
+ }
+ print ' | ';
+ print " \n";
+ }
- print " \n";
- print " \n";
+ print " \n";
+
+ print "\n";
+
+ if ($message) { print $message; }
+
+
+ /*
+ * Barre d'actions
+ */
+
+ print '\n";
+ print " \n";
- /*
- * Liste des groupes dans lequel est l'utilisateur
- */
+ /*
+ * Liste des groupes dans lequel est l'utilisateur
+ */
- print_fiche_titre($langs->trans("ListOfGroupsForUser"));
+ print_fiche_titre($langs->trans("ListOfGroupsForUser"));
- // On selectionne les groups
- $uss = array();
+ // On selectionne 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";
+ $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;
+ $resql = $db->query($sql);
+ if ($resql)
+ {
+ $num = $db->num_rows($resql);
+ $i = 0;
- while ($i < $num)
- {
- $obj = $db->fetch_object($resql);
+ while ($i < $num)
+ {
+ $obj = $db->fetch_object($resql);
- $uss[$obj->rowid] = $obj->nom;
- $i++;
- }
- }
- else {
- dolibarr_print_error($db);
- }
+ $uss[$obj->rowid] = $obj->nom;
+ $i++;
+ }
+ }
+ else {
+ dolibarr_print_error($db);
+ }
- if ($caneditperms)
- {
- $form = new Form($db);
- print ''."\n";
+ if ($caneditperms)
+ {
+ $form = new Form($db);
+ print ''."\n";
- print ' ';
- }
+ print ' ';
+ }
- /*
- * Groupes affectes
- */
- $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 " ";
- $db->free($result);
- }
- else {
- dolibarr_print_error($db);
- }
-
- }
-
- /*
- * Fiche en mode edition
- */
- if ($_GET["action"] == 'edit' && ($caneditperms || ($user->id == $fuser->id)))
- {
-
- print '';
+
+ print '';
+ }
+
+ $ldap->close;
+ }
}
$db->close();
|