Removed getCompleteNameAttribute(), modified getFullNameAttribute()

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2023-08-21 20:11:17 +01:00
parent f3460b5a4f
commit 354550b52e

View file

@ -247,21 +247,12 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo
*/
public function getFullNameAttribute()
{
return $this->first_name.' '.$this->last_name;
}
$setting = Setting::getSettings();
/**
* Returns the complete name attribute with username
*
* @todo refactor this so it's less repetitive and dumb
*
* @author A. Gianotto <snipe@snipe.net>
* @since [v2.0]
* @return string
*/
public function getCompleteNameAttribute()
{
return $this->last_name.', '.$this->first_name.' ('.$this->username.')';
if ($setting->name_display_format=='last_first') {
return ($this->last_name) ? $this->last_name.' '.$this->first_name : $this->first_name;
}
return $this->last_name ? $this->first_name.' '.$this->last_name : $this->first_name;
}