mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 10:38:45 +02:00
Code cleanup (MakeHyperlink and GetHyperlink) + Data load and web services unit tests
SVN:code[35]
This commit is contained in:
@@ -287,6 +287,15 @@ abstract class DBObject
|
||||
return $this->m_aCurrValues[$sAttCode];
|
||||
}
|
||||
|
||||
public function GetOriginal($sAttCode)
|
||||
{
|
||||
if (!array_key_exists($sAttCode, MetaModel::ListAttributeDefs(get_class($this))))
|
||||
{
|
||||
trigger_error("Unknown attribute code '$sAttCode' for the class ".get_class($this), E_USER_ERROR);
|
||||
}
|
||||
return $this->m_aOrigValues[$sAttCode];
|
||||
}
|
||||
|
||||
public function ComputeFields()
|
||||
{
|
||||
if (is_callable(array($this, 'ComputeValues')))
|
||||
@@ -305,16 +314,6 @@ abstract class DBObject
|
||||
}
|
||||
}
|
||||
|
||||
public function GetHyperLink($sLabel = "")
|
||||
{
|
||||
if (empty($sLabel))
|
||||
{
|
||||
$sLabel = $this->GetName();
|
||||
}
|
||||
$aAvailableFields = array($sLabel);
|
||||
return call_user_func(array(get_class($this), 'MakeHyperLink'), get_class($this), $this->GetKey(), $aAvailableFields);
|
||||
}
|
||||
|
||||
public function GetAsHTML($sAttCode)
|
||||
{
|
||||
$sClass = get_class($this);
|
||||
@@ -334,7 +333,15 @@ abstract class DBObject
|
||||
}
|
||||
|
||||
$sTargetClass = $oAtt->GetTargetClass(EXTKEY_ABSOLUTE);
|
||||
return call_user_func(array(get_class($this), 'MakeHyperLink'), $sTargetClass, $this->Get($sAttCode), $aAvailableFields);
|
||||
$aMakeHLink = array(get_class($this), 'MakeHyperLink');
|
||||
if (is_callable($aMakeHLink))
|
||||
{
|
||||
return call_user_func($aMakeHLink, $sTargetClass, $this->Get($sAttCode), $aAvailableFields);
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->Get($sAttCode);
|
||||
}
|
||||
}
|
||||
|
||||
// That's a standard attribute (might be an ext field or a direct field, etc.)
|
||||
|
||||
Reference in New Issue
Block a user