mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-21 09:38:48 +02:00
Enhancement / bug fix: allow the overload of the GetName method for building the short name of an object. This is also used when the object appears in a drop-down list.
SVN:trunk[325]
This commit is contained in:
@@ -214,7 +214,7 @@ abstract class cmdbAbstractObject extends CMDBObject
|
||||
}
|
||||
|
||||
function GetBareDetails(WebPage $oPage)
|
||||
{
|
||||
{
|
||||
$sHtml = '';
|
||||
$oAppContext = new ApplicationContext();
|
||||
$sStateAttCode = MetaModel::GetStateAttributeCode(get_class($this));
|
||||
@@ -266,7 +266,8 @@ abstract class cmdbAbstractObject extends CMDBObject
|
||||
if (!empty($sTemplate))
|
||||
{
|
||||
$oTemplate = new DisplayTemplate($sTemplate);
|
||||
$oTemplate->Render($oPage, array('class_name'=> MetaModel::GetName(get_class($this)),'class'=> get_class($this),'pkey'=> $this->GetKey(), 'name' => $this->GetName()));
|
||||
$sNameAttCode = MetaModel::GetNameAttributeCode(get_class($this));
|
||||
$oTemplate->Render($oPage, array('class_name'=> MetaModel::GetName(get_class($this)),'class'=> get_class($this),'pkey'=> $this->GetKey(), 'name' => $this->Get($sNameAttCode)));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -96,15 +96,17 @@ class ValueSetObjects extends ValueSetDefinition
|
||||
$oFilter = DBObjectSearch::FromSibusQL($this->m_sFilterExpr, $aArgs);
|
||||
if (!$oFilter) return false;
|
||||
|
||||
if (empty($this->m_sValueAttCode))
|
||||
{
|
||||
$this->m_sValueAttCode = MetaModel::GetNameAttributeCode($oFilter->GetClass());
|
||||
}
|
||||
|
||||
$oObjects = new DBObjectSet($oFilter, $this->m_aOrderBy, $aArgs);
|
||||
while ($oObject = $oObjects->Fetch())
|
||||
{
|
||||
$this->m_aValues[$oObject->GetKey()] = $oObject->GetAsHTML($this->m_sValueAttCode);
|
||||
if (empty($this->m_sValueAttCode))
|
||||
{
|
||||
$this->m_aValues[$oObject->GetKey()] = $oObject->GetName();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->m_aValues[$oObject->GetKey()] = $oObject->GetAsHTML($this->m_sValueAttCode);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user