Code cleanup (MakeHyperlink and GetHyperlink) + Data load and web services unit tests

SVN:code[35]
This commit is contained in:
Romain Quetiez
2009-04-14 16:19:51 +00:00
parent 65ffc8c2f8
commit 74da660194
6 changed files with 188 additions and 29 deletions

View File

@@ -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.)