* Copyright (C) 2002-2003 Jean-Louis Bergamo * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2004 Eric Seigne * Copyright (C) 2005-2015 Regis Houssin * Copyright (C) 2005 Lionel Cousteix * Copyright (C) 2011 Herve Prot * Copyright (C) 2012 Juanjo Menent * Copyright (C) 2013 Florian Henry * Copyright (C) 2013-2015 Alexandre Spangaro * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2015 Ari Elbaz (elarifr) * * 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 3 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, see . */ /** * \file htdocs/user/card.php * \brief Tab of user card */ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; if (! empty($conf->ldap->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/ldap.class.php'; if (! empty($conf->adherent->enabled)) require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; if (! empty($conf->multicompany->enabled)) dol_include_once('/multicompany/class/actions_multicompany.class.php'); $id = GETPOST('id','int'); $action = GETPOST('action','alpha'); $confirm = GETPOST('confirm','alpha'); $subaction = GETPOST('subaction','alpha'); $group = GETPOST("group","int",3); // Define value to know what current user can do on users $canadduser=(! empty($user->admin) || $user->rights->user->user->creer); $canreaduser=(! empty($user->admin) || $user->rights->user->user->lire); $canedituser=(! empty($user->admin) || $user->rights->user->user->creer); $candisableuser=(! empty($user->admin) || $user->rights->user->user->supprimer); $canreadgroup=$canreaduser; $caneditgroup=$canedituser; if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { $canreadgroup=(! empty($user->admin) || $user->rights->user->group_advance->read); $caneditgroup=(! empty($user->admin) || $user->rights->user->group_advance->write); } // Define value to know what current user can do on properties of edited user if ($id) { // $user est le user qui edite, $id est l'id de l'utilisateur edite $caneditfield=((($user->id == $id) && $user->rights->user->self->creer) || (($user->id != $id) && $user->rights->user->user->creer)); $caneditpassword=((($user->id == $id) && $user->rights->user->self->password) || (($user->id != $id) && $user->rights->user->user->password)); } // Security check $socid=0; if ($user->societe_id > 0) $socid = $user->societe_id; $feature2='user'; if ($user->id == $id) { $feature2=''; $canreaduser=1; } // A user can always read its own card if (!$canreaduser) { $result = restrictedArea($user, 'user', $id, 'user&user', $feature2); } if ($user->id <> $id && ! $canreaduser) accessforbidden(); $langs->load("users"); $langs->load("companies"); $langs->load("ldap"); $langs->load("admin"); $object = new User($db); $extrafields = new ExtraFields($db); // fetch optionals attributes and labels $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array('usercard','globalcard')); /** * Actions */ if ($action == 'confirm_disable' && $confirm == "yes" && $candisableuser) { if ($id <> $user->id) { $object->fetch($id); $object->setstatus(0); header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id); exit; } } if ($action == 'confirm_enable' && $confirm == "yes" && $candisableuser) { $error = 0; if ($id <> $user->id) { $object->fetch($id); if (!empty($conf->file->main_limit_users)) { $nb = $object->getNbOfUsers("active"); if ($nb >= $conf->file->main_limit_users) { $error++; setEventMessage($langs->trans("YourQuotaOfUsersIsReached"), 'errors'); } } if (! $error) { $object->setstatus(1); header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id); exit; } } } if ($action == 'confirm_delete' && $confirm == "yes" && $candisableuser) { if ($id <> $user->id) { $object = new User($db); $object->id=$id; $result = $object->delete(); if ($result < 0) { $langs->load("errors"); setEventMessage($langs->trans("ErrorUserCannotBeDelete"), 'errors'); } else { header("Location: index.php"); exit; } } } // Action Add user if ($action == 'add' && $canadduser) { $error = 0; if (! $_POST["lastname"]) { $error++; setEventMessage($langs->trans("NameNotDefined"), 'errors'); $action="create"; // Go back to create page } if (! $_POST["login"]) { $error++; setEventMessage($langs->trans("LoginNotDefined"), 'errors'); $action="create"; // Go back to create page } if (! empty($conf->file->main_limit_users)) // If option to limit users is set { $nb = $object->getNbOfUsers("active"); if ($nb >= $conf->file->main_limit_users) { $error++; setEventMessage($langs->trans("YourQuotaOfUsersIsReached"), 'errors'); $action="create"; // Go back to create page } } if (!$error) { $object->lastname = GETPOST("lastname",'alpha'); $object->firstname = GETPOST("firstname",'alpha'); $object->login = GETPOST("login",'alpha'); $object->api_key = GETPOST("api_key",'alpha'); $object->gender = GETPOST("gender",'alpha'); $object->admin = GETPOST("admin",'alpha'); $object->office_phone = GETPOST("office_phone",'alpha'); $object->office_fax = GETPOST("office_fax",'alpha'); $object->user_mobile = GETPOST("user_mobile"); $object->skype = GETPOST("skype"); $object->email = GETPOST("email",'alpha'); $object->job = GETPOST("job",'alpha'); $object->signature = GETPOST("signature"); $object->accountancy_code = GETPOST("accountancy_code"); $object->note = GETPOST("note"); $object->ldap_sid = GETPOST("ldap_sid"); $object->fk_user = GETPOST("fk_user")>0?GETPOST("fk_user"):0; $object->thm = GETPOST("thm")!=''?GETPOST("thm"):''; $object->tjm = GETPOST("tjm")!=''?GETPOST("tjm"):''; $object->salary = GETPOST("salary")!=''?GETPOST("salary"):''; $object->salaryextra = GETPOST("salaryextra")!=''?GETPOST("salaryextra"):''; $object->weeklyhours = GETPOST("weeklyhours")!=''?GETPOST("weeklyhours"):''; $object->color = GETPOST("color")!=''?GETPOST("color"):''; // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels,$object); if ($ret < 0) $error++; // Set entity property $entity=GETPOST('entity','int'); if (! empty($conf->multicompany->enabled)) { if (! empty($_POST["superadmin"])) { $object->entity = 0; } else if ($conf->multicompany->transverse_mode) { $object->entity = 1; // all users are forced into master entity } else { $object->entity = ($entity == '' ? 1 : $entity); } } else { $object->entity = ($entity == '' ? 1 : $entity); /*if ($user->admin && $user->entity == 0 && GETPOST("admin",'alpha')) { }*/ } $db->begin(); $id = $object->create($user); if ($id > 0) { if (isset($_POST['password']) && trim($_POST['password'])) { $object->setPassword($user,trim($_POST['password'])); } $db->commit(); header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id); exit; } else { $langs->load("errors"); $db->rollback(); if (is_array($object->errors) && count($object->errors)) setEventMessage($object->errors,'errors'); else setEventMessage($object->error, 'errors'); $action="create"; // Go back to create page } } } // Action add usergroup if (($action == 'addgroup' || $action == 'removegroup') && $caneditfield) { if ($group) { $editgroup = new UserGroup($db); $editgroup->fetch($group); $editgroup->oldcopy=dol_clone($editgroup); $object->fetch($id); if ($action == 'addgroup') $object->SetInGroup($group,($conf->multicompany->transverse_mode?GETPOST("entity"):$editgroup->entity)); if ($action == 'removegroup') $object->RemoveFromGroup($group,($conf->multicompany->transverse_mode?GETPOST("entity"):$editgroup->entity)); if ($result > 0) { header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id); exit; } else { setEventMessage($object->error, 'errors'); } } } if ($action == 'update' && ! $_POST["cancel"]) { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; if ($caneditfield) // Case we can edit all field { $error=0; if (! $_POST["lastname"]) { setEventMessage($langs->trans("NameNotDefined"), 'errors'); $action="edit"; // Go back to create page $error++; } if (! $_POST["login"]) { setEventMessage($langs->trans("LoginNotDefined"), 'errors'); $action="edit"; // Go back to create page $error++; } if (! $error) { $object->fetch($id); // Test if new login if (GETPOST("login") && GETPOST("login") != $object->login) { dol_syslog("New login ".$object->login." is requested. We test it does not exists."); $tmpuser=new User($db); $result=$tmpuser->fetch(0, GETPOST("login")); if ($result > 0) { setEventMessage($langs->trans("ErrorLoginAlreadyExists", GETPOST('login')), 'errors'); $action="edit"; // Go back to create page $error++; } } } if (! $error) { $db->begin(); $object->oldcopy=dol_clone($object); $object->lastname = GETPOST("lastname",'alpha'); $object->firstname = GETPOST("firstname",'alpha'); $object->login = GETPOST("login",'alpha'); $object->gender = GETPOST("gender",'alpha'); $object->pass = GETPOST("password"); $object->api_key = (GETPOST("api_key", 'alpha'))?GETPOST("api_key", 'alpha'):$object->api_key; $object->admin = empty($user->admin)?0:GETPOST("admin"); // A user can only be set admin by an admin $object->office_phone=GETPOST("office_phone",'alpha'); $object->office_fax = GETPOST("office_fax",'alpha'); $object->user_mobile= GETPOST("user_mobile"); $object->skype = GETPOST("skype"); $object->email = GETPOST("email",'alpha'); $object->job = GETPOST("job",'alpha'); $object->signature = GETPOST("signature"); $object->accountancy_code = GETPOST("accountancy_code"); $object->openid = GETPOST("openid"); $object->fk_user = GETPOST("fk_user")>0?GETPOST("fk_user"):0; $object->thm = GETPOST("thm")!=''?GETPOST("thm"):''; $object->tjm = GETPOST("tjm")!=''?GETPOST("tjm"):''; $object->salary = GETPOST("salary")!=''?GETPOST("salary"):''; $object->salaryextra = GETPOST("salaryextra")!=''?GETPOST("salaryextra"):''; $object->weeklyhours = GETPOST("weeklyhours")!=''?GETPOST("weeklyhours"):''; $object->color = GETPOST("color")!=''?GETPOST("color"):''; // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels,$object); if ($ret < 0) $error++; if (! empty($conf->multicompany->enabled)) { if (! empty($_POST["superadmin"])) { $object->entity = 0; } else if ($conf->multicompany->transverse_mode) { $object->entity = 1; // all users in master entity } else { $object->entity = (empty($_POST["entity"]) ? 0 : $_POST["entity"]); } } else { $object->entity = (empty($_POST["entity"]) ? 0 : $_POST["entity"]); } if (GETPOST('deletephoto')) $object->photo=''; if (! empty($_FILES['photo']['name'])) $object->photo = dol_sanitizeFileName($_FILES['photo']['name']); if (! $error) { $ret=$object->update($user); if ($ret < 0) { $error++; if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); setEventMessage($langs->trans("ErrorLoginAlreadyExists",$object->login), 'errors'); } else { setEventMessages($object->error, $object->errors, 'errors'); } } } if (! $error && isset($_POST['contactid'])) { $contactid=GETPOST('contactid'); if ($contactid > 0) { $contact=new Contact($db); $contact->fetch($contactid); $sql = "UPDATE ".MAIN_DB_PREFIX."user"; $sql.= " SET fk_socpeople=".$db->escape($contactid); if ($contact->socid) $sql.=", fk_soc=".$db->escape($contact->socid); $sql.= " WHERE rowid=".$object->id; } else { $sql = "UPDATE ".MAIN_DB_PREFIX."user"; $sql.= " SET fk_socpeople=NULL, fk_soc=NULL"; $sql.= " WHERE rowid=".$object->id; } dol_syslog("fiche::update", LOG_DEBUG); $resql=$db->query($sql); if (! $resql) { $error++; setEventMessage($db->lasterror(), 'errors'); } } if (! $error && ! count($object->errors)) { if (GETPOST('deletephoto') && $object->photo) { $fileimg=$conf->user->dir_output.'/'.get_exdir($object->id,2,0,1,$object,'user').'/logos/'.$object->photo; $dirthumbs=$conf->user->dir_output.'/'.get_exdir($object->id,2,0,1,$object,'user').'/logos/thumbs'; dol_delete_file($fileimg); dol_delete_dir_recursive($dirthumbs); } if (isset($_FILES['photo']['tmp_name']) && trim($_FILES['photo']['tmp_name'])) { $dir= $conf->user->dir_output . '/' . get_exdir($object->id,2,0,1,$object,'user'); dol_mkdir($dir); if (@is_dir($dir)) { $newfile=$dir.'/'.dol_sanitizeFileName($_FILES['photo']['name']); $result=dol_move_uploaded_file($_FILES['photo']['tmp_name'],$newfile,1,0,$_FILES['photo']['error']); if (! $result > 0) { setEventMessage($langs->trans("ErrorFailedToSaveFile"), 'errors'); } else { // Create small thumbs for company (Ratio is near 16/9) // Used on logon for example $imgThumbSmall = vignette($newfile, $maxwidthsmall, $maxheightsmall, '_small', $quality); // Create mini thumbs for company (Ratio is near 16/9) // Used on menu or for setup page for example $imgThumbMini = vignette($newfile, $maxwidthmini, $maxheightmini, '_mini', $quality); } } else { $error++; $langs->load("errors"); setEventMessages($langs->transnoentitiesnoconv("ErrorFailedToCreateDir", $dir), $mesgs, 'errors'); } } } if (! $error && ! count($object->errors)) { setEventMessage($langs->trans("UserModified")); $db->commit(); $login=$_SESSION["dol_login"]; if ($login && $login == $object->oldcopy->login && $object->oldcopy->login != $object->login) // Current user has changed its login { $_SESSION["dol_login"]=$object->login; // Set new login to avoid disconnect at next page } } else { $db->rollback(); } } } else if ($caneditpassword) // Case we can edit only password { $object->fetch($id); $object->oldcopy=dol_clone($object); $ret=$object->setPassword($user,$_POST["password"]); if ($ret < 0) { setEventMessage($object->error, 'errors'); } } } // Change password with a new generated one if ((($action == 'confirm_password' && $confirm == 'yes') || ($action == 'confirm_passwordsend' && $confirm == 'yes')) && $caneditpassword) { $object->fetch($id); $newpassword=$object->setPassword($user,''); if ($newpassword < 0) { // Echec setEventMessage($langs->trans("ErrorFailedToSetNewPassword"), 'errors'); } else { // Succes if ($action == 'confirm_passwordsend' && $confirm == 'yes') { if ($object->send_password($user,$newpassword) > 0) { setEventMessage($langs->trans("PasswordChangedAndSentTo",$object->email)); } else { setEventMessage($object->error, 'errors'); } } else { setEventMessage($langs->trans("PasswordChangedTo",$newpassword), 'errors'); } } } // Action initialisation donnees depuis record LDAP if ($action == 'adduserldap') { $selecteduser = $_POST['users']; $required_fields = array( $conf->global->LDAP_KEY_USERS, $conf->global->LDAP_FIELD_NAME, $conf->global->LDAP_FIELD_FIRSTNAME, $conf->global->LDAP_FIELD_LOGIN, $conf->global->LDAP_FIELD_LOGIN_SAMBA, $conf->global->LDAP_FIELD_PASSWORD, $conf->global->LDAP_FIELD_PASSWORD_CRYPTED, $conf->global->LDAP_FIELD_PHONE, $conf->global->LDAP_FIELD_FAX, $conf->global->LDAP_FIELD_MOBILE, $conf->global->LDAP_FIELD_SKYPE, $conf->global->LDAP_FIELD_MAIL, $conf->global->LDAP_FIELD_TITLE, $conf->global->LDAP_FIELD_DESCRIPTION, $conf->global->LDAP_FIELD_SID); $ldap = new Ldap(); $result = $ldap->connect_bind(); if ($result >= 0) { // Remove from required_fields all entries not configured in LDAP (empty) and duplicated $required_fields=array_unique(array_values(array_filter($required_fields, "dol_validElement"))); $ldapusers = $ldap->getRecords($selecteduser, $conf->global->LDAP_USER_DN, $conf->global->LDAP_KEY_USERS, $required_fields); //print_r($ldapusers); if (is_array($ldapusers)) { foreach ($ldapusers as $key => $attribute) { $ldap_lastname = $attribute[$conf->global->LDAP_FIELD_NAME]; $ldap_firstname = $attribute[$conf->global->LDAP_FIELD_FIRSTNAME]; $ldap_login = $attribute[$conf->global->LDAP_FIELD_LOGIN]; $ldap_loginsmb = $attribute[$conf->global->LDAP_FIELD_LOGIN_SAMBA]; $ldap_pass = $attribute[$conf->global->LDAP_FIELD_PASSWORD]; $ldap_pass_crypted = $attribute[$conf->global->LDAP_FIELD_PASSWORD_CRYPTED]; $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_skype = $attribute[$conf->global->LDAP_FIELD_SKYPE]; $ldap_mail = $attribute[$conf->global->LDAP_FIELD_MAIL]; $ldap_sid = $attribute[$conf->global->LDAP_FIELD_SID]; } } } else { setEventMessage($ldap->error, 'errors'); } } /* * View */ $form = new Form($db); $formother=new FormOther($db); llxHeader('',$langs->trans("UserCard")); if (($action == 'create') || ($action == 'adduserldap')) { /* ************************************************************************** */ /* */ /* Affichage fiche en mode creation */ /* */ /* ************************************************************************** */ print_fiche_titre($langs->trans("NewUser")); print $langs->trans("CreateInternalUserDesc")."
\n"; print "
"; if (! empty($conf->ldap->enabled) && (isset($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE == 'ldap2dolibarr')) { /* * Affiche formulaire d'ajout d'un compte depuis LDAP * si on est en synchro LDAP vers Dolibarr */ $ldap = new Ldap(); $result = $ldap->connect_bind(); if ($result >= 0) { $required_fields=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, $conf->global->LDAP_FIELD_PASSWORD, $conf->global->LDAP_FIELD_PASSWORD_CRYPTED, $conf->global->LDAP_FIELD_PHONE, $conf->global->LDAP_FIELD_FAX, $conf->global->LDAP_FIELD_MOBILE, $conf->global->LDAP_FIELD_SKYPE, $conf->global->LDAP_FIELD_MAIL, $conf->global->LDAP_FIELD_TITLE, $conf->global->LDAP_FIELD_DESCRIPTION, $conf->global->LDAP_FIELD_SID ); // Remove from required_fields all entries not configured in LDAP (empty) and duplicated $required_fields=array_unique(array_values(array_filter($required_fields, "dol_validElement"))); // Get from LDAP database an array of results $ldapusers = $ldap->getRecords('*', $conf->global->LDAP_USER_DN, $conf->global->LDAP_KEY_USERS, $required_fields, 1); if (is_array($ldapusers)) { $liste=array(); foreach ($ldapusers as $key => $ldapuser) { // Define the label string for this user $label=''; foreach ($required_fields as $value) { if ($value) { $label.=$value."=".$ldapuser[$value]." "; } } $liste[$key] = $label; } } else { setEventMessage($ldap->error, 'errors'); } } else { setEventMessage($ldap->error, 'errors'); } // If user list is full, we show drop-down list print "\n\n\n"; print '
'; print ''; print ''; print ''; print '
'; print $langs->trans("LDAPUsers"); print ''; print ''; if (is_array($liste) && count($liste)) { print $form->selectarray('users', $liste, '', 1); } print ''; print ''; print '
'; print '
'; print "\n\n\n"; print '
'; } print '
'; print ''; print ''; if (! empty($ldap_sid)) print ''; print ''; dol_fiche_head('', '', '', 0, ''); print dol_set_focus('#lastname'); print ''; print ''; // Lastname print ''; print ''; // Firstname print ''; print ''; // Position/Job print ''; print ''; // Gender print ''; print ''; // Login print ''; print ''; $generated_password=''; if (empty($ldap_sid)) // ldap_sid is for activedirectory { require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; $generated_password=getRandomPassword(false); } $password=$generated_password; // Password print ''; print ''; if(! empty($conf->api->enabled)) { // API key $generated_api_key = ''; require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; $generated_password=getRandomPassword(false); print ''; print ''; } else { // PARTIAL WORKAROUND $generated_fake_api_key=getRandomPassword(false); print ''; } // Administrator if (! empty($user->admin)) { print ''; print '\n"; } // Type print ''; print ''; // Tel print ''; print ''; // Tel portable print ''; print ''; // Fax print ''; print ''; // Skype if (! empty($conf->skype->enabled)) { print ''; print ''; } // EMail print 'global->USER_MAIL_REQUIRED)?' class="fieldrequired"':'').'>'.$langs->trans("EMail").''; print ''; // Signature print ''; print ''; // Multicompany if (! empty($conf->multicompany->enabled)) { if (empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity && is_object($mc)) { print "".''; print "\n"; } else { print ''; } } // Hierarchy print ''; print ''; print "\n"; if ($conf->salaries->enabled && ! empty($user->rights->salaries->read)) { $langs->load("salaries"); // THM print ''; print ''; print "\n"; // TJM print ''; print ''; print "\n"; // Salary print ''; print ''; print "\n"; } // Weeklyhours print ''; print ''; print "\n"; // Accountancy code if ($conf->salaries->enabled) { print ''; print ''; } // User color if (! empty($conf->agenda->enabled)) { print ''; print ''; } // Note print '\n"; // Other attributes $parameters=array('objectsrc' => $objectsrc, 'colspan' => ' colspan="3"'); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook if (empty($reshook) && ! empty($extrafields->attribute_label)) { print $object->showOptionals($extrafields,'edit'); } print "
'.$langs->trans("Lastname").''; if (! empty($ldap_lastname)) { print ''; print $ldap_lastname; } else { print ''; } print '
'.$langs->trans("Firstname").''; if (! empty($ldap_firstname)) { print ''; print $ldap_firstname; } else { print ''; } print '
'.$langs->trans("PostOrFunction").''; print ''; print '
'.$langs->trans("Gender").''; $arraygender=array('man'=>$langs->trans("Genderman"),'woman'=>$langs->trans("Genderwoman")); print $form->selectarray('gender', $arraygender, GETPOST('gender'), 1); print '
'.$langs->trans("Login").''; if (! empty($ldap_login)) { print ''; print $ldap_login; } elseif (! empty($ldap_loginsmb)) { print ''; print $ldap_loginsmb; } else { print ''; } print '
'.$langs->trans("Password").''; if (! empty($ldap_sid)) { print 'Mot de passe du domaine'; } else { if (! empty($ldap_pass)) { print ''; print preg_replace('/./i','*',$ldap_pass); } else { // We do not use a field password but a field text to show new password to use. print ''; } } print '
'.$langs->trans("ApiKey").''; print ''; if (! empty($conf->use_javascript_ajax)) print ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_api_key" class="linkobject"'); print '
'.$langs->trans("Administrator").''; print $form->selectyesno('admin',GETPOST('admin'),1); if (! empty($conf->multicompany->enabled) && ! $user->entity && empty($conf->multicompany->transverse_mode)) { if (! empty($conf->use_javascript_ajax)) { print ''; } $checked=($_POST["superadmin"]?' checked':''); $disabled=($_POST["superadmin"]?'':' disabled'); print ' '.$langs->trans("SuperAdministrator"); } print "
'.$langs->trans("Type").''; print $form->textwithpicto($langs->trans("Internal"),$langs->trans("InternalExternalDesc"), 1, 'help', '', 0, 2); print '
'.$langs->trans("PhonePro").''; if (! empty($ldap_phone)) { print ''; print $ldap_phone; } else { print ''; } print '
'.$langs->trans("PhoneMobile").''; if (! empty($ldap_mobile)) { print ''; print $ldap_mobile; } else { print ''; } print '
'.$langs->trans("Fax").''; if (! empty($ldap_fax)) { print ''; print $ldap_fax; } else { print ''; } print '
'.$langs->trans("Skype").''; if (! empty($ldap_skype)) { print ''; print $ldap_skype; } else { print ''; } print '
'; if (! empty($ldap_mail)) { print ''; print $ldap_mail; } else { print ''; } print '
'.$langs->trans("Signature").''; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor=new DolEditor('signature',GETPOST('signature'),'',138,'dolibarr_mailings','In',true,true,empty($conf->global->FCKEDITOR_ENABLE_USERSIGN)?0:1,ROWS_4,90); print $doleditor->Create(1); print '
'.$langs->trans("Entity").'".$mc->select_entities($conf->entity); print "
'.$langs->trans("HierarchicalResponsible").''; print $form->select_dolusers($object->fk_user,'fk_user',1,array($object->id),0,'',0,$conf->entity); print '
'.$langs->trans("THM").''; print ''; print '
'.$langs->trans("TJM").''; print ''; print '
'.$langs->trans("Salary").''; print ''; print '
'.$langs->trans("WeeklyHours").''; print ''; print '
'.$langs->trans("AccountancyCode").''; print ''; print '
'.$langs->trans("ColorUser").''; print $formother->selectColor(GETPOST('color')?GETPOST('color'):$object->color, 'color', 'usercolorconfig', 1, '', 'hideifnotset'); print '
'; print $langs->trans("Note"); print ''; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor=new DolEditor('note','','',180,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,ROWS_4,90); $doleditor->Create(); print "
\n"; dol_fiche_end(); print '
'; print ''; //print '     '; //print ''; print '
'; print "
"; } else { /* ************************************************************************** */ /* */ /* View and edition */ /* */ /* ************************************************************************** */ if ($id > 0) { $object->fetch($id); if ($res < 0) { dol_print_error($db,$object->error); exit; } $res=$object->fetch_optionals($object->id,$extralabels); // Connexion ldap // pour recuperer passDoNotExpire et userChangePassNextLogon if (! empty($conf->ldap->enabled) && ! empty($object->ldap_sid)) { $ldap = new Ldap(); $result=$ldap->connect_bind(); if ($result > 0) { $userSearchFilter = '('.$conf->global->LDAP_FILTER_CONNECTION.'('.$ldap->getUserIdentifier().'='.$object->login.'))'; $entries = $ldap->fetch($object->login,$userSearchFilter); if (! $entries) { setEventMessage($ldap->error, 'errors'); } $passDoNotExpire = 0; $userChangePassNextLogon = 0; $userDisabled = 0; $statutUACF = ''; // Check options of user account if (count($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; } } } // Show tabs $head = user_prepare_head($object); $title = $langs->trans("User"); /* * Confirmation reinitialisation mot de passe */ if ($action == 'password') { print $form->formconfirm("card.php?id=$object->id",$langs->trans("ReinitPassword"),$langs->trans("ConfirmReinitPassword",$object->login),"confirm_password", '', 0, 1); } /* * Confirmation envoi mot de passe */ if ($action == 'passwordsend') { print $form->formconfirm("card.php?id=$object->id",$langs->trans("SendNewPassword"),$langs->trans("ConfirmSendNewPassword",$object->login),"confirm_passwordsend", '', 0, 1); } /* * Confirm deactivation */ if ($action == 'disable') { print $form->formconfirm("card.php?id=$object->id",$langs->trans("DisableAUser"),$langs->trans("ConfirmDisableUser",$object->login),"confirm_disable", '', 0, 1); } /* * Confirm activation */ if ($action == 'enable') { print $form->formconfirm("card.php?id=$object->id",$langs->trans("EnableAUser"),$langs->trans("ConfirmEnableUser",$object->login),"confirm_enable", '', 0, 1); } /* * Confirmation suppression */ if ($action == 'delete') { print $form->formconfirm("card.php?id=$object->id",$langs->trans("DeleteAUser"),$langs->trans("ConfirmDeleteUser",$object->login),"confirm_delete", '', 0, 1); } /* * Fiche en mode visu */ if ($action != 'edit') { dol_fiche_head($head, 'user', $title, 0, 'user'); $rowspan=19; print ''; // Ref print ''; print ''; print ''."\n"; if (isset($conf->file->main_authentication) && preg_match('/openid/',$conf->file->main_authentication) && ! empty($conf->global->MAIN_OPENIDURL_PERUSER)) $rowspan++; if (! empty($conf->societe->enabled)) $rowspan++; if (! empty($conf->adherent->enabled)) $rowspan++; if (! empty($conf->skype->enabled)) $rowspan++; if (! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read)) $rowspan = $rowspan+3; if (! empty($conf->agenda->enabled)) $rowspan++; // Lastname print ''; print ''; // Photo print ''; print ''."\n"; // Firstname print ''; print ''; print ''."\n"; // Position/Job print ''; print ''; print ''."\n"; // Gender print ''; print ''; // Login print ''; if (! empty($object->ldap_sid) && $object->statut==0) { print ''; } else { print ''; } print ''."\n"; // Password print ''; if (! empty($object->ldap_sid)) { if ($passDoNotExpire) { print ''; } else if($userChangePassNextLogon) { print ''; } else if($userDisabled) { print ''; } else { print ''; } } else { print '"; } print ''."\n"; // API key if(! empty($conf->api->enabled) && $user->admin) { print ''; print ''."\n"; // Type print ''."\n"; // Ldap sid if ($object->ldap_sid) { print ''."\n"; } // Tel pro print ''; print ''; print ''."\n"; // Tel mobile print ''; print ''; print ''."\n"; // Fax print ''; print ''; print ''."\n"; // Skype if (! empty($conf->skype->enabled)) { print ''; print ''; print "\n"; } // EMail print ''; print ''; print "\n"; // Signature print '\n"; // Hierarchy print ''; print ''; print "\n"; if (! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read)) { $langs->load("salaries"); // THM print ''; print ''; print "\n"; // TJM print ''; print ''; print "\n"; // Salary print ''; print ''; print "\n"; } // Weeklyhours print ''; print ''; print "\n"; // Accountancy code if ($conf->salaries->enabled) { print ''; print ''; } // Color user if (! empty($conf->agenda->enabled)) { print ''; print ''; print "\n"; } // Status print ''; print ''; print ''."\n"; print ''; print ''; print "\n"; print ''; print ''; print "\n"; if (isset($conf->file->main_authentication) && preg_match('/openid/',$conf->file->main_authentication) && ! empty($conf->global->MAIN_OPENIDURL_PERUSER)) { print ''; print ''; print "\n"; } // Company / Contact if (! empty($conf->societe->enabled)) { print ''; print ''; print ''."\n"; } // Module Adherent if (! empty($conf->adherent->enabled)) { $langs->load("members"); print ''; print ''; print ''."\n"; } // Multicompany // TODO This should be done with hook formObjectOption if (is_object($mc)) { if (! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity) { print '\n"; } } // Other attributes $parameters=array('colspan' => ' colspan="2"'); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook if (empty($reshook) && ! empty($extrafields->attribute_label)) { print $object->showOptionals($extrafields); } print "
'.$langs->trans("Ref").''; print $form->showrefnav($object,'id','',$user->rights->user->user->lire || $user->admin); print '
'.$langs->trans("Lastname").''.$object->lastname.''; print $form->showphoto('userphoto',$object,100); print '
'.$langs->trans("Firstname").''.$object->firstname.'
'.$langs->trans("PostOrFunction").''.$object->job.'
'.$langs->trans("Gender").''; if ($object->gender) print $langs->trans("Gender".$object->gender); print '
'.$langs->trans("Login").''.$langs->trans("LoginAccountDisableInDolibarr").''.$object->login.'
'.$langs->trans("Password").''.$langs->trans("LdapUacf_".$statutUACF).''.$langs->trans("UserMustChangePassNextLogon",$ldap->domainFQDN).''.$langs->trans("LdapUacf_".$statutUACF,$ldap->domainFQDN).''.$langs->trans("DomainPassword").''; if ($object->pass) print preg_replace('/./i','*',$object->pass); else { if ($user->admin) print $langs->trans("Crypted").': '.$object->pass_indatabase_crypted; else print $langs->trans("Hidden"); } print "
'.$langs->trans("ApiKey").''; if (! empty($object->api_key)) print $langs->trans("Hidden"); print ''; } // Administrator print '
'.$langs->trans("Administrator").''; if (! empty($conf->multicompany->enabled) && $object->admin && ! $object->entity) { print $form->textwithpicto(yn($object->admin),$langs->trans("SuperAdministratorDesc"),1,"superadmin"); } else if ($object->admin) { print $form->textwithpicto(yn($object->admin),$langs->trans("AdministratorDesc"),1,"admin"); } else { print yn($object->admin); } print '
'; $text=$langs->trans("Type"); print $form->textwithpicto($text, $langs->trans("InternalExternalDesc")); print ''; $type=$langs->trans("Internal"); if ($object->societe_id > 0) $type=$langs->trans("External"); print $type; if ($object->ldap_sid) print ' ('.$langs->trans("DomainUser").')'; print '
'.$langs->trans("Type").''; print $langs->trans("DomainUser",$ldap->domainFQDN); print '
'.$langs->trans("PhonePro").''.dol_print_phone($object->office_phone,'',0,0,1).'
'.$langs->trans("PhoneMobile").''.dol_print_phone($object->user_mobile,'',0,0,1).'
'.$langs->trans("Fax").''.dol_print_phone($object->office_fax,'',0,0,1).'
'.$langs->trans("Skype").''.dol_print_skype($object->skype,0,0,1).'
'.$langs->trans("EMail").''.dol_print_email($object->email,0,0,1).'
'.$langs->trans('Signature').''; print dol_htmlentitiesbr($object->signature); print "
'.$langs->trans("HierarchicalResponsible").''; if (empty($object->fk_user)) print $langs->trans("None"); else { $huser=new User($db); $huser->fetch($object->fk_user); print $huser->getNomUrl(1); } print '
'; $text=$langs->trans("THM"); print $form->textwithpicto($text, $langs->trans("THMDescription"), 1, 'help', 'classthm'); print ''; print ($object->thm!=''?price($object->thm,'',$langs,1,-1,-1,$conf->currency):''); print '
'; $text=$langs->trans("TJM"); print $form->textwithpicto($text, $langs->trans("TJMDescription"), 1, 'help', 'classtjm'); print ''; print ($object->tjm!=''?price($object->tjm,'',$langs,1,-1,-1,$conf->currency):''); print '
'.$langs->trans("Salary").''; print ($object->salary!=''?price($object->salary,'',$langs,1,-1,-1,$conf->currency):''); print '
'.$langs->trans("WeeklyHours").''; print price2num($object->weeklyhours); print '
'.$langs->trans("AccountancyCode").''.$object->accountancy_code.'
'.$langs->trans("ColorUser").''; print $formother->showColor($object->color, ''); print '
'.$langs->trans("Status").''; print $object->getLibStatut(4); print '
'.$langs->trans("LastConnexion").''.dol_print_date($object->datelastlogin,"dayhour").'
'.$langs->trans("PreviousConnexion").''.dol_print_date($object->datepreviouslogin,"dayhour").'
'.$langs->trans("OpenIDURL").''.$object->openid.'
'.$langs->trans("LinkToCompanyContact").''; if (isset($object->societe_id) && $object->societe_id > 0) { $societe = new Societe($db); $societe->fetch($object->societe_id); print $societe->getNomUrl(1,''); } else { print $langs->trans("ThisUserIsNot"); } if (! empty($object->contact_id)) { $contact = new Contact($db); $contact->fetch($object->contact_id); if ($object->societe_id > 0) print ' / '; else print '
'; print ''.img_object($langs->trans("ShowContact"),'contact').' '.dol_trunc($contact->getFullName($langs),32).''; } print '
'.$langs->trans("LinkedToDolibarrMember").''; if ($object->fk_member) { $adh=new Adherent($db); $adh->fetch($object->fk_member); $adh->ref=$adh->getFullname($langs); // Force to show login instead of id print $adh->getNomUrl(1); } else { print $langs->trans("UserNotLinkedToMember"); } print '
'.$langs->trans("Entity").''; if (empty($object->entity)) { print $langs->trans("AllEntities"); } else { $mc->getInfo($object->entity); print $mc->label; } print "
\n"; dol_fiche_end(); /* * Buttons actions */ print '
'; if ($caneditfield && (empty($conf->multicompany->enabled) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->multicompany->transverse_mode && $conf->entity == 1))) { if (! empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED)) { print ''; } else { print ''; } } elseif ($caneditpassword && ! $object->ldap_sid && (empty($conf->multicompany->enabled) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->multicompany->transverse_mode && $conf->entity == 1))) { print ''; } // Si on a un gestionnaire de generation de mot de passe actif if ($conf->global->USER_PASSWORD_GENERATED != 'none') { if ($object->statut == 0) { print ''; } elseif (($user->id != $id && $caneditpassword) && $object->login && !$object->ldap_sid && ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->multicompany->transverse_mode && $conf->entity == 1))) { print ''; } if ($object->statut == 0) { print ''; } else if (($user->id != $id && $caneditpassword) && $object->login && !$object->ldap_sid && ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->multicompany->transverse_mode && $conf->entity == 1))) { if ($object->email) print ''; else print ''; } } // Activer if ($user->id <> $id && $candisableuser && $object->statut == 0 && ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->multicompany->transverse_mode && $conf->entity == 1))) { print ''; } // Desactiver if ($user->id <> $id && $candisableuser && $object->statut == 1 && ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->multicompany->transverse_mode && $conf->entity == 1))) { print ''; } // Delete if ($user->id <> $id && $candisableuser && ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->multicompany->transverse_mode && $conf->entity == 1))) { if ($user->admin || ! $object->admin) // If user edited is admin, delete is possible on for an admin { print ''; } else { print ''; } } print "
\n"; print "
\n"; /* * Liste des groupes dans lequel est l'utilisateur */ if ($canreadgroup) { print_fiche_titre($langs->trans("ListOfGroupsForUser"),'',''); // On selectionne les groupes auquel fait parti le user $exclude = array(); $usergroup=new UserGroup($db); $groupslist = $usergroup->listGroupsForUser($object->id); if (! empty($groupslist)) { if (! (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode))) { foreach($groupslist as $groupforuser) { $exclude[]=$groupforuser->id; } } } if ($caneditgroup) { print '
'."\n"; print ''; print ''; print ''."\n"; print ''."\n"; print ''; print "'."\n"; print '
'.$langs->trans("GroupsToAdd").''; print $form->select_dolgroups('', 'group', 1, $exclude, 0, '', '', $object->entity); print '   '; // Multicompany if (! empty($conf->multicompany->enabled)) { if ($conf->entity == 1 && $conf->multicompany->transverse_mode) { print ''.$langs->trans("Entity").'".$mc->select_entities($conf->entity); } else { print ''; } } else { print ''; } print ''; print '
'."\n"; print '
'; } /* * Groups assigned to user */ print ''; print ''; print ''; if(! empty($conf->multicompany->enabled) && !empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity) { print ''; } print "\n"; if (! empty($groupslist)) { $var=true; foreach($groupslist as $group) { $var=!$var; print ""; print ''; if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity) { print '\n"; } } else { print ''; } print "
'.$langs->trans("Groups").''.$langs->trans("Entity").' 
'; if ($caneditgroup) { print ''.img_object($langs->trans("ShowGroup"),"group").' '.$group->name.''; } else { print img_object($langs->trans("ShowGroup"),"group").' '.$group->name; } print ''; if (! empty($group->usergroup_entity)) { $nb=0; foreach($group->usergroup_entity as $group_entity) { $mc->getInfo($group_entity); print ($nb > 0 ? ', ' : '').$mc->label; print ''; print img_delete($langs->trans("RemoveFromGroup")); print ''; $nb++; } } } print ''; if ($caneditgroup && empty($conf->multicompany->transverse_mode)) { print ''; print img_delete($langs->trans("RemoveFromGroup")); print ''; } else { print " "; } print "
'.$langs->trans("None").'
"; print "
"; } } /* * Fiche en mode edition */ if ($action == 'edit' && ($canedituser || $caneditfield || $caneditpassword || ($user->id == $object->id))) { print '
'; print ''; print ''; print ''; dol_fiche_head($head, 'user', $title, 0, 'user'); $rowspan=17; if (isset($conf->file->main_authentication) && preg_match('/openid/',$conf->file->main_authentication) && ! empty($conf->global->MAIN_OPENIDURL_PERUSER)) $rowspan++; if (! empty($conf->societe->enabled)) $rowspan++; if (! empty($conf->adherent->enabled)) $rowspan++; if (! empty($conf->skype->enabled)) $rowspan++; if (! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read)) $rowspan = $rowspan+3; if (! empty($conf->agenda->enabled)) $rowspan++; print ''; print ''; print ''; print ''; // Lastname print ""; print ''; print ''; // Photo print ''; print ''; // Firstname print "".''; print ''; // Position/Job print ''; print ''; // Gender print ''; print ''; // Login print "".''; print ''; print ''; // Pass print ''; print '\n"; // API key if(! empty($conf->api->enabled) && $user->admin) { print ''; print ''; } // Administrator print ''; if ($object->societe_id > 0) { $langs->load("admin"); print ''; } else { print ''; } // Type print ''; print ''; // Tel pro print "".''; print ''; // Tel mobile print "".''; print ''; // Fax print "".''; print ''; // Skype if (! empty($conf->skype->enabled)) { print ''; print ''; } // EMail print "".'global->USER_MAIL_REQUIRED)?' class="fieldrequired"':'').'>'.$langs->trans("EMail").''; print ''; // Signature print "".''; print ''; // OpenID url if (isset($conf->file->main_authentication) && preg_match('/openid/',$conf->file->main_authentication) && ! empty($conf->global->MAIN_OPENIDURL_PERUSER)) { print "".''; print ''; } // Hierarchy print ''; print ''; print "\n"; if (! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read)) { $langs->load("salaries"); // THM print ''; print ''; print "\n"; // TJM print ''; print ''; print "\n"; // Salary print ''; print ''; print "\n"; } // Weeklyhours print ''; print ''; print "\n"; // Accountancy code if ($conf->salaries->enabled) { print ""; print ''; print ''; print ""; } // User color if (! empty($conf->agenda->enabled)) { print ''; print ''; } // Status print ''; print ''; // Company / Contact if (! empty($conf->societe->enabled)) { print ''; print ''; print "\n"; } // Module Adherent if (! empty($conf->adherent->enabled)) { $langs->load("members"); print ''; print ''; print "\n"; } // Multicompany // TODO check if user not linked with the current entity before change entity (thirdparty, invoice, etc.) !! if (! empty($conf->multicompany->enabled) && is_object($mc)) { if (empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity) { print "".''; print "\n"; } else { print ''; } } // Other attributes $parameters=array('colspan' => ' colspan="2"'); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook if (empty($reshook) && ! empty($extrafields->attribute_label)) { print $object->showOptionals($extrafields,'edit'); } print '
'.$langs->trans("Ref").''; print $object->id; print '
'.$langs->trans("Lastname").''; if ($caneditfield && !$object->ldap_sid) { print ''; } else { print ''; print $object->lastname; } print ''; print $form->showphoto('userphoto',$object,100,0,$caneditfield); print '
'.$langs->trans("Firstname").''; if ($caneditfield && !$object->ldap_sid) { print ''; } else { print ''; print $object->firstname; } print '
'.$langs->trans("PostOrFunction").''; if ($caneditfield) { print ''; } else { print ''; print $object->job; } print '
'.$langs->trans("Gender").''; $arraygender=array('man'=>$langs->trans("Genderman"),'woman'=>$langs->trans("Genderwoman")); print $form->selectarray('gender', $arraygender, GETPOST('gender')?GETPOST('gender'):$object->gender, 1); print '
'.$langs->trans("Login").''; if ($user->admin && !$object->ldap_sid) { print ''; } else { print ''; print $object->login; } print '
'.$langs->trans("Password").''; if ($object->ldap_sid) { $text=$langs->trans("DomainPassword"); } else if ($caneditpassword) { $text=''; if ($dolibarr_main_authentication && $dolibarr_main_authentication == 'http') { $text=$form->textwithpicto($text,$langs->trans("DolibarrInHttpAuthenticationSoPasswordUseless",$dolibarr_main_authentication),1,'warning'); } } else { $text=preg_replace('/./i','*',$object->pass); } print $text; print "
'.$langs->trans("ApiKey").''; print ''; if (! empty($conf->use_javascript_ajax)) print ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_api_key" class="linkobject"'); print '
'.$langs->trans("Administrator").''; print ''.yn($object->admin); print ' ('.$langs->trans("ExternalUser").')'; print '
'; $nbSuperAdmin = $user->getNbOfUsers('superadmin'); if ($user->admin && ($user->id != $object->id) // Don't downgrade ourself && ($object->entity > 0 || $nbSuperAdmin > 1) // Don't downgrade a superadmin if alone ) { print $form->selectyesno('admin',$object->admin,1); if (! empty($conf->multicompany->enabled) && ! $user->entity && empty($conf->multicompany->transverse_mode)) { if ($conf->use_javascript_ajax) { print ''; } $checked=(($object->admin && ! $object->entity) ? ' checked' : ''); print ' '.$langs->trans("SuperAdministrator"); } } else { $yn = yn($object->admin); print ''; print ''; if (! empty($conf->multicompany->enabled) && empty($object->entity)) print $form->textwithpicto($yn,$langs->trans("DontDowngradeSuperAdmin"),1,'warning'); else print $yn; } print '
'.$langs->trans("Type").''; if ($user->id == $object->id || ! $user->admin) { $type=$langs->trans("Internal"); if ($object->societe_id) $type=$langs->trans("External"); print $form->textwithpicto($type,$langs->trans("InternalExternalDesc")); if ($object->ldap_sid) print ' ('.$langs->trans("DomainUser").')'; } else { $type=0; if ($object->contact_id) $type=$object->contact_id; print $form->selectcontacts(0,$type,'contactid',2,'','',1,'',false,1); if ($object->ldap_sid) print ' ('.$langs->trans("DomainUser").')'; } print '
'.$langs->trans("PhonePro").''; if ($caneditfield && empty($object->ldap_sid)) { print ''; } else { print ''; print $object->office_phone; } print '
'.$langs->trans("PhoneMobile").''; if ($caneditfield && empty($object->ldap_sid)) { print ''; } else { print ''; print $object->user_mobile; } print '
'.$langs->trans("Fax").''; if ($caneditfield && empty($object->ldap_sid)) { print ''; } else { print ''; print $object->office_fax; } print '
'.$langs->trans("Skype").''; if ($caneditfield && empty($object->ldap_sid)) { print ''; } else { print ''; print $object->skype; } print '
'; if ($caneditfield && empty($object->ldap_sid)) { print ''; } else { print ''; print $object->email; } print '
'.$langs->trans("Signature").''; if ($caneditfield) { require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor=new DolEditor('signature',$object->signature,'',138,'dolibarr_mailings','In',false,true,empty($conf->global->FCKEDITOR_ENABLE_USERSIGN)?0:1,ROWS_4,72); print $doleditor->Create(1); } else { print dol_htmlentitiesbr($object->signature); } print '
'.$langs->trans("OpenIDURL").''; if ($caneditfield) { print ''; } else { print ''; print $object->openid; } print '
'.$langs->trans("HierarchicalResponsible").''; if ($caneditfield) { print $form->select_dolusers($object->fk_user,'fk_user',1,array($object->id),0,'',0,$object->entity); } else { print ''; $huser=new User($db); $huser->fetch($object->fk_user); print $huser->getNomUrl(1); } print '
'; $text=$langs->trans("THM"); print $form->textwithpicto($text, $langs->trans("THMDescription"), 1, 'help', 'classthm'); print ''; print ''; print '
'; $text=$langs->trans("TJM"); print $form->textwithpicto($text, $langs->trans("TJMDescription"), 1, 'help', 'classthm'); print ''; print ''; print '
'.$langs->trans("Salary").''; print ''; print '
'.$langs->trans("WeeklyHours").''; print ''; print '
'.$langs->trans("AccountancyCode").''; if ($caneditfield) { print ''; } else { print ''; print $object->accountancy_code; } print '
'.$langs->trans("ColorUser").''; print $formother->selectColor(GETPOST('color')?GETPOST('color'):$object->color, 'color', 'usercolorconfig', 1, '', 'hideifnotset'); print '
'.$langs->trans("Status").''; print $object->getLibStatut(4); print '
'.$langs->trans("LinkToCompanyContact").''; if ($object->societe_id > 0) { $societe = new Societe($db); $societe->fetch($object->societe_id); print $societe->getNomUrl(1,''); if ($object->contact_id) { $contact = new Contact($db); $contact->fetch($object->contact_id); print ' / '.img_object($langs->trans("ShowContact"),'contact').' '.dol_trunc($contact->getFullName($langs),32).''; } } else { print $langs->trans("ThisUserIsNot"); } print ' ('.$langs->trans("UseTypeFieldToChange").')'; print '
'.$langs->trans("LinkedToDolibarrMember").''; if ($object->fk_member) { $adh=new Adherent($db); $adh->fetch($object->fk_member); $adh->ref=$adh->login; // Force to show login instead of id print $adh->getNomUrl(1); } else { print $langs->trans("UserNotLinkedToMember"); } print '
'.$langs->trans("Entity").'".$mc->select_entities($object->entity, 'entity', '', 0, 1); // last parameter 1 means, show also a choice 0=>'all entities' print "
'; dol_fiche_end(); print '
'; print ''; print '     '; print ''; print '
'; print '
'; } if (! empty($conf->ldap->enabled) && ! empty($object->ldap_sid)) $ldap->close; } } if (! empty($conf->api->enabled) && ! empty($conf->use_javascript_ajax)) { print "\n".''; } llxFooter(); $db->close();