Firstname only on login

This commit is contained in:
Laurent Destailleur 2015-09-21 17:28:11 +02:00
parent fd90ac517f
commit 58a734cb17
6 changed files with 13 additions and 7 deletions

View File

@ -389,7 +389,7 @@ abstract class CommonObject
*
* @param Translate $langs Language object for translation of civility
* @param int $option 0=No option, 1=Add civility
* @param int $nameorder -1=Auto, 0=Lastname+Firstname, 1=Firstname+Lastname
* @param int $nameorder -1=Auto, 0=Lastname+Firstname, 1=Firstname+Lastname, 2=Firstname
* @param int $maxlen Maximum length
* @return string String with full name
*/

View File

@ -4297,12 +4297,16 @@ function dolGetFirstLastname($firstname,$lastname,$nameorder=-1)
$ret='';
// If order not defined, we use the setup
if ($nameorder < 0) $nameorder=(empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION));
if ($nameorder)
if ($nameorder && $nameorder != '2')
{
$ret.=$firstname;
if ($firstname && $lastname) $ret.=' ';
$ret.=$lastname;
}
else if ($nameorder == 2)
{
$ret.=$firstname;
}
else
{
$ret.=$lastname;

View File

@ -1390,8 +1390,8 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
</script>' . "\n";
// Raven.js for client-side Sentry logging support
if (array_key_exists('mod_syslog_sentry', $conf->loghandlers) && ! empty($conf->global->SYSLOG_SENTRY_DSN)) {
if (array_key_exists('mod_syslog_sentry', $conf->loghandlers) && ! empty($conf->global->SYSLOG_SENTRY_DSN))
{
// Filter out secret key
$dsn = parse_url($conf->global->SYSLOG_SENTRY_DSN);
$public_dsn = $dsn['scheme'] . '://' . $dsn['user'] .'@' . $dsn['host'] . $dsn['path'];
@ -1465,7 +1465,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
// Login name with tooltip
$toprightmenu.='<div class="inline-block nowrap"><div class="inline-block login_block_elem" style="padding: 0px;">';
$toprightmenu.=$user->getNomurl(0, '', true, 0, 11);
$toprightmenu.=$user->getNomurl(0, '', true, 0, 11, 0, 'firstname');
$toprightmenu.='</div></div>';
$toprightmenu.='</div>';

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -500,6 +500,7 @@ td.showDragHandle {
margin-bottom: 0px;
display: table;
table-layout: fixed;
width: 100%;
}
#id-right, #id-left {
display: table-cell;

View File

@ -1836,9 +1836,10 @@ class User extends CommonObject
* @param integer $notooltip 1=Disable tooltip
* @param int $maxlen Max length of visible user name
* @param int $hidethirdpartylogo Hide logo of thirdparty if user is external user
* @param string $mode 'firstname'=Show only firstname
* @return string String with URL
*/
function getNomUrl($withpicto=0, $option='', $infologin=0, $notooltip=0, $maxlen=24, $hidethirdpartylogo=0)
function getNomUrl($withpicto=0, $option='', $infologin=0, $notooltip=0, $maxlen=24, $hidethirdpartylogo=0, $mode='')
{
global $langs, $conf, $db;
global $dolibarr_main_authentication, $dolibarr_main_demo;
@ -1905,7 +1906,7 @@ class User extends CommonObject
$result.=($link.img_object(($notooltip?'':$label), 'user', ($notooltip?'':'class="classfortooltip"')).$linkend);
if ($withpicto != 2) $result.=' ';
}
$result.= $link . $this->getFullName($langs,'',-1,$maxlen) . $linkend . $companylink;
$result.= $link . $this->getFullName($langs,'',($mode == 'firstname' ? 2 : -1),$maxlen) . $linkend . $companylink;
return $result;
}