mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Fix: User creation must use same rule if from contact and from member.
This commit is contained in:
parent
64457363ce
commit
901d5e235a
|
|
@ -1020,6 +1020,12 @@ if ($rowid && $action != 'edit')
|
|||
if ($_GET["action"] == 'create_user')
|
||||
{
|
||||
$login=$adh->login;
|
||||
if (empty($login))
|
||||
{
|
||||
// Full firstname and name separated with a dot : firstname.name
|
||||
include_once(DOL_DOCUMENT_ROOT.'/lib/functions2.lib.php');
|
||||
$login=dol_buildlogin($adh->nom,$adh->prenom);
|
||||
}
|
||||
if (empty($login)) $login=strtolower(substr($adh->prenom, 0, 4)) . strtolower(substr($adh->nom, 0, 4));
|
||||
|
||||
// Create a form array
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
/**
|
||||
* \file htdocs/contact/fiche.php
|
||||
* \ingroup societe
|
||||
* \brief Onglet general d'un contact
|
||||
* \brief Card of a contact
|
||||
* \version $Id$
|
||||
*/
|
||||
|
||||
|
|
@ -757,11 +757,10 @@ else
|
|||
|
||||
if ($_GET["action"] == 'create_user')
|
||||
{
|
||||
// Full firstname and name separated with a dot : firstname.name
|
||||
// TODO add function
|
||||
$login=strtolower(dol_string_unaccent($object->prenom)) .'.'. strtolower(dol_string_unaccent($object->nom));
|
||||
$login=dol_string_nospecial($login,''); // For special names
|
||||
|
||||
// Full firstname and name separated with a dot : firstname.name
|
||||
include_once(DOL_DOCUMENT_ROOT.'/lib/functions2.lib.php');
|
||||
$login=dol_buildlogin($object->nom,$object->prenom);
|
||||
|
||||
// Create a form array
|
||||
$formquestion=array(array('label' => $langs->trans("LoginToCreate"), 'type' => 'text', 'name' => 'login', 'value' => $login));
|
||||
|
||||
|
|
|
|||
|
|
@ -1099,8 +1099,8 @@ function getListOfModels($db,$type)
|
|||
}
|
||||
|
||||
/**
|
||||
* \brief This function evaluates a string that should be a valid IPv4
|
||||
* \return It returns 0 if $ip is not a valid IPv4
|
||||
* This function evaluates a string that should be a valid IPv4
|
||||
* @return It returns 0 if $ip is not a valid IPv4
|
||||
* It returns 1 if $ip is a valid IPv4 and is a public IP
|
||||
* It returns 2 if $ip is a valid IPv4 and is a private lan IP
|
||||
*/
|
||||
|
|
@ -1115,3 +1115,16 @@ function is_ip($ip)
|
|||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Build a login from lastname, firstname
|
||||
* @param lastname Lastname
|
||||
* @param firstname Firstname
|
||||
* @return string
|
||||
*/
|
||||
function dol_buildlogin($lastname,$firstname)
|
||||
{
|
||||
$login=strtolower(dol_string_unaccent($firstname)) .'.'. strtolower(dol_string_unaccent($lastname));
|
||||
$login=dol_string_nospecial($login,''); // For special names
|
||||
return $login;
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user