diff --git a/application/dashlet.class.inc.php b/application/dashlet.class.inc.php index abbfc9716..56a20a54a 100644 --- a/application/dashlet.class.inc.php +++ b/application/dashlet.class.inc.php @@ -444,6 +444,16 @@ EOF $sClass = $oQuery->GetClass(); foreach($this->oModelReflection->ListAttributes($sClass) as $sAttCode => $sAttType) { + // For external fields, find the real type of the target + $sTargetClass = $sClass; + while (is_a($sAttType, 'AttributeExternalField', true)) + { + $sExtKeyAttCode = $this->oModelReflection->GetAttributeProperty($sTargetClass, $sAttCode, 'extkey_attcode'); + $sTargetAttCode = $this->oModelReflection->GetAttributeProperty($sTargetClass, $sAttCode, 'target_attcode'); + $sTargetClass = $this->oModelReflection->GetAttributeProperty($sTargetClass, $sExtKeyAttCode, 'targetclass'); + $aTargetAttCodes = $this->oModelReflection->ListAttributes($sTargetClass); + $sAttType = $aTargetAttCodes[$sTargetAttCode]; + } if (is_a($sAttType, 'AttributeLinkedSet', true)) { continue; @@ -456,15 +466,6 @@ EOF { continue; } - // For external fields, find the real type of the target - while (is_a($sAttType, 'AttributeExternalField', true)) - { - $sExtKeyAttCode = $this->oModelReflection->GetAttributeProperty($sClass, $sAttCode, 'extkey_attcode'); - $sTargetClass = $this->oModelReflection->GetAttributeProperty($sClass, $sExtKeyAttCode, 'targetclass'); - $sTargetAttCode = $this->oModelReflection->GetAttributeProperty($sClass, $sAttCode, 'target_attcode'); - $aTargetAttCodes = $this->oModelReflection->ListAttributes($sTargetClass); - $sAttType = $aTargetAttCodes[$sTargetAttCode]; - } $sLabel = $this->oModelReflection->GetLabel($sClass, $sAttCode); if (!in_array($sLabel, $aGroupBy)) diff --git a/core/attributedef.class.inc.php b/core/attributedef.class.inc.php index 287215967..909c1887e 100644 --- a/core/attributedef.class.inc.php +++ b/core/attributedef.class.inc.php @@ -6242,6 +6242,15 @@ class AttributeExternalKey extends AttributeDBFieldVoid return $oFormField; } + public function GetAsHTML($sValue, $oHostObject = null, $bLocalize = true) + { + if (!is_null($oHostObject)) + { + return $oHostObject->GetAsHTML($this->GetCode(), $oHostObject); + } + + return DBObject::MakeHyperLink($this->GetTargetClass(), $sValue); + } } /**