N°1963 - Dashlet GroupBy: allow ExternalField selection in UI

This commit is contained in:
Eric
2019-02-26 15:31:31 +01:00
parent ddd9188eb7
commit 1cb36621a1
2 changed files with 19 additions and 9 deletions

View File

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

View File

@@ -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);
}
}
/**