Fixed #8721 - duplicate asset tags in select list when asset has name

This commit is contained in:
snipe 2020-12-21 13:43:54 -08:00
parent 13ed6cde67
commit e6ba4a423d

View file

@ -361,18 +361,13 @@ class AssetPresenter extends Presenter
/**
* Get Displayable Name
* @return string
*
* @todo this should be factored out - it should be subsumed by fullName (below)
*
**/
public function name()
{
if (empty($this->model->name)) {
if (isset($this->model->model)) {
return $this->model->model->name.' ('.$this->model->asset_tag.')';
}
return $this->model->asset_tag;
}
return $this->model->name . ' (' . $this->model->asset_tag . ')';
return $this->fullName;
}
/**
@ -382,13 +377,18 @@ class AssetPresenter extends Presenter
public function fullName()
{
$str = '';
// Asset name
if ($this->model->name) {
$str .= $this->name;
$str .= $this->model->name;
}
// Asset tag
if ($this->asset_tag) {
$str .= ' ('.$this->model->asset_tag.')';
}
// Asset Model name
if ($this->model->model) {
$str .= ' - '.$this->model->model->name;
}