Custom fields: track the changes and improve the robustness with regards to the Exception thrown by the handler. Also fixed an issue with DBObject, causing the custom fields to be written several times if invoking DBUpdate more than once. Theoretically, this issue affects any type of attribute.

SVN:trunk[3966]
This commit is contained in:
Romain Quetiez
2016-03-24 10:49:04 +00:00
parent 922354320b
commit 847c1d2736
6 changed files with 194 additions and 47 deletions

View File

@@ -59,21 +59,21 @@ class ormCustomFieldsValue
public function GetAsHTML($bLocalize = true)
{
$oAttDef = MetaModel::GetAttributeDef(get_class($this->oHostObject), $this->sAttCode);
$oHandler = $oAttDef->GetHandler($this->oHostObject, $this->GetValues());
$oHandler = $oAttDef->GetHandler($this->GetValues());
return $oHandler->GetAsHTML($this->aCurrentValues, $bLocalize);
}
public function GetAsXML($bLocalize = true)
{
$oAttDef = MetaModel::GetAttributeDef(get_class($this->oHostObject), $this->sAttCode);
$oHandler = $oAttDef->GetHandler($this->oHostObject, $this->GetValues());
$oHandler = $oAttDef->GetHandler($this->GetValues());
return $oHandler->GetAsXML($this->aCurrentValues, $bLocalize);
}
public function GetAsCSV($sSeparator = ',', $sTextQualifier = '"', $bLocalize = true)
{
$oAttDef = MetaModel::GetAttributeDef(get_class($this->oHostObject), $this->sAttCode);
$oHandler = $oAttDef->GetHandler($this->oHostObject, $this->GetValues());
$oHandler = $oAttDef->GetHandler($this->GetValues());
return $oHandler->GetAsCSV($this->aCurrentValues, $sSeparator = ',', $sTextQualifier = '"', $bLocalize = true);
}
@@ -86,7 +86,7 @@ class ormCustomFieldsValue
public function GetForTemplate($sVerb, $bLocalize = true)
{
$oAttDef = MetaModel::GetAttributeDef(get_class($this->oHostObject), $this->sAttCode);
$oHandler = $oAttDef->GetHandler($this->oHostObject, $this->GetValues());
$oHandler = $oAttDef->GetHandler($this->GetValues());
return 'template...verb='.$sVerb.' sur "'.json_encode($this->aCurrentValues).'"';
}
@@ -97,7 +97,7 @@ class ormCustomFieldsValue
public function Equals(ormCustomFieldsValue $oReference)
{
$oAttDef = MetaModel::GetAttributeDef(get_class($this->oHostObject), $this->sAttCode);
$oHandler = $oAttDef->GetHandler($this->oHostObject, $this->GetValues());
$oHandler = $oAttDef->GetHandler($this->GetValues());
return $oHandler->CompareValues($this->aCurrentValues, $oReference->aCurrentValues);
}
}