diff --git a/htdocs/adherents/fiche.php b/htdocs/adherents/fiche.php index c473ea56362..89ff1c4bb63 100644 --- a/htdocs/adherents/fiche.php +++ b/htdocs/adherents/fiche.php @@ -1,7 +1,7 @@ * Copyright (C) 2002-2003 Jean-Louis Bergamo - * Copyright (C) 2004-2010 Laurent Destailleur + * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2011 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -1018,9 +1018,15 @@ if ($rowid && $action != 'edit') // Create a form array $formquestion=array( - array('label' => $langs->trans("LoginToCreate"), 'type' => 'text', 'name' => 'login', 'value' => $login)); - - $ret=$html->form_confirm($_SERVER["PHP_SELF"]."?rowid=".$adh->id,$langs->trans("CreateDolibarrLogin"),$langs->trans("ConfirmCreateLogin"),"confirm_create_user",$formquestion,'yes'); + array('label' => $langs->trans("LoginToCreate"), 'type' => 'text', 'name' => 'login', 'value' => $login) + ); + $text=$langs->trans("ConfirmCreateLogin").'
'; + if ($conf->societe->enabled) + { + if ($adh->fk_soc > 0) $text.=$langs->trans("UserWillBeExternalUser"); + else $text.=$langs->trans("UserWillBeInternalUser"); + } + $ret=$html->form_confirm($_SERVER["PHP_SELF"]."?rowid=".$adh->id,$langs->trans("CreateDolibarrLogin"),$text,"confirm_create_user",$formquestion,'yes'); if ($ret == 'html') print '
'; } diff --git a/htdocs/contact/fiche.php b/htdocs/contact/fiche.php index 4eca7f382a5..fad88ea48d9 100644 --- a/htdocs/contact/fiche.php +++ b/htdocs/contact/fiche.php @@ -767,9 +767,16 @@ else // Create a form array $formquestion=array( array('label' => $langs->trans("LoginToCreate"), 'type' => 'text', 'name' => 'login', 'value' => $login), - array('label' => $langs->trans("Password"), 'type' => 'text', 'name' => 'password', 'value' => $password)); - - $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("CreateDolibarrLogin"),$langs->trans("ConfirmCreateContact"),"confirm_create_user",$formquestion,'no'); + array('label' => $langs->trans("Password"), 'type' => 'text', 'name' => 'password', 'value' => $password), + //array('label' => $form->textwithpicto($langs->trans("Type"),$langs->trans("InternalExternalDesc")), 'type' => 'select', 'name' => 'intern', 'default' => 1, 'values' => array(0=>$langs->trans('Internal'),1=>$langs->trans('External'))) + ); + $text=$langs->trans("ConfirmCreateContact").'
'; + if ($conf->societe->enabled) + { + if ($object->socid > 0) $text.=$langs->trans("UserWillBeExternalUser"); + else $text.=$langs->trans("UserWillBeInternalUser"); + } + $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("CreateDolibarrLogin"),$text,"confirm_create_user",$formquestion,'yes'); if ($ret == 'html') print '
'; } @@ -805,6 +812,7 @@ else print $object->getCivilityLabel(); print ''; + // Role print ''.$langs->trans("PostOrFunction" ).''.$object->poste.''; // Address diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 930e1a2330c..5ed9bed24ad 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1998,7 +1998,7 @@ class Form { $more.=''; if (! empty($input['label'])) $more.=$input['label'].''; - $more.=$this->selectarray($input['name'],$input['values'],'',1); + $more.=$this->selectarray($input['name'],$input['values'],$input['default'],1); $more.=''."\n"; } else if ($input['type'] == 'checkbox') diff --git a/htdocs/langs/en_US/users.lang b/htdocs/langs/en_US/users.lang index 95c560b9c1b..68ac685a3fa 100755 --- a/htdocs/langs/en_US/users.lang +++ b/htdocs/langs/en_US/users.lang @@ -92,6 +92,8 @@ CreateInternalUserDesc=This form allows you to creat an user internal to your co InternalExternalDesc=An internal user is a user that is part of your company/foundation.
An external user is a customer, supplier or other.

In both cases, permissions defines rights on Dolibarr, also external user can have a different menu manager than internal user (See Home - Setup - Display) PermissionInheritedFromAGroup=Permission granted because inherited from one of a user's group. Inherited=Inherited +UserWillBeInternalUser=Created user will be an internal user (because not linked to a particular third party) +UserWillBeExternalUser=Created user will be an external user (because linked to a particular third party) IdPhoneCaller=Id phone caller UserLogged=User %s login UserLogoff=User %s logout diff --git a/htdocs/langs/fr_FR/users.lang b/htdocs/langs/fr_FR/users.lang index 9698b8b3cb5..00cf3ac62de 100755 --- a/htdocs/langs/fr_FR/users.lang +++ b/htdocs/langs/fr_FR/users.lang @@ -92,6 +92,8 @@ CreateInternalUserDesc=Cet écran permet de créer un utilisateur interne à vot InternalExternalDesc=Un utilisateur interne est un utilisateur appartenant à votre société/institution.
Un utilisateur externe est un utilisateur client, fournisseur ou autre.

Dans les 2 cas, les permissions utilisateurs définissent les droits d'accès mais l'utilisateur externe peut en plus avoir un gestionnaire de menu différent de l'utilisateur interne (Voir Accueil - Configuration - Affichage) PermissionInheritedFromAGroup=La permission est accordée car héritée d'un groupe auquel appartient l'utilisateur. Inherited=Hérité +UserWillBeInternalUser=L'utilisateur créé sera un utilisateur interne (car non lié à un tiers en particulier) +UserWillBeExternalUser=L'utilisateur créé sera un utilisateur externe (car lié à un tiers en particulier) IdPhoneCaller=Id appelant (téléphone) UserLogged=Connexion utilisateur %s UserLogoff=Déconnexion utilisateur %s diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 9486a840f5c..109a08e10fa 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -69,6 +69,7 @@ class User extends CommonObject var $datec; var $datem; + //! If this is defined, it is an external user var $societe_id; var $fk_member; @@ -810,11 +811,11 @@ class User extends CommonObject /** - * Cree en base un utilisateur depuis l'objet contact - * @param contact Objet du contact source - * @param login Login to force - * @param password Password to force - * @return int <0 if error, if OK returns id of created user + * Create a user from a contact object. User will be internal but if contact is linked to a third party, user will be external. + * @param contact Object for source contact + * @param login Login to force + * @param password Password to force + * @return int <0 if error, if OK returns id of created user */ function create_from_contact($contact,$login='',$password='') { @@ -875,10 +876,10 @@ class User extends CommonObject } /** - * \brief Cree en base un utilisateur depuis l'objet adherent - * \param member Objet adherent source - * \param login Login to force - * \return int Si erreur <0, si ok renvoie id compte cree + * Create a user into database from a member object + * @param member Object member source + * @param login Login to force + * @return int <0 if KO, if OK, return id of created account */ function create_from_member($member,$login='') { @@ -904,6 +905,7 @@ class User extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."user"; $sql.= " SET fk_member=".$member->id; + if ($member->fk_soc) $sql.= ", fk_societe=".$member->fk_soc; $sql.= " WHERE rowid=".$this->id; dol_syslog("User::create_from_member sql=".$sql, LOG_DEBUG); @@ -975,12 +977,12 @@ class User extends CommonObject } /** - * \brief Mise e jour en base d'un utilisateur (sauf info mot de passe) - * \param user User qui fait la mise a jour - * \param notrigger 1 ne declenche pas les triggers, 0 sinon - * \param nosyncmember 0=Synchronize linked member (standard info), 1=Do not synchronize linked member - * \param nosyncmemberpass 0=Synchronize linked member (password), 1=Do not synchronize linked member - * \return int <0 si KO, >=0 si OK + * Update a user into databse (except password) + * @param user User qui fait la mise a jour + * @param notrigger 1 ne declenche pas les triggers, 0 sinon + * @param nosyncmember 0=Synchronize linked member (standard info), 1=Do not synchronize linked member + * @param nosyncmemberpass 0=Synchronize linked member (password), 1=Do not synchronize linked member + * @return int <0 si KO, >=0 si OK */ function update($user,$notrigger=0,$nosyncmember=0,$nosyncmemberpass=0) {