Advanced Search: Fix ExternalFields allowed values

SVN:trunk[5668]
This commit is contained in:
Eric Espié
2018-04-13 15:27:00 +00:00
parent 9d5ab75dbd
commit ec2aadb7cf
2 changed files with 27 additions and 5 deletions

View File

@@ -746,10 +746,30 @@ class ScalarExpression extends UnaryExpression
{
switch (true)
{
case ($oAttDef instanceof AttributeExternalField):
try
{
if ($this->GetValue() == 0)
{
$aValue['label'] = Dict::S('UI:UndefinedObject');
}
else
{
/** @var AttributeExternalKey $oAttDef */
$sTarget = $oAttDef->GetFinalAttDef()->GetTargetClass();
$oObj = MetaModel::GetObject($sTarget, $this->GetValue());
$aValue['label'] = $oObj->Get("friendlyname");
}
}
catch (Exception $e)
{
IssueLog::Error($e->getMessage());
}
break;
case $oAttDef->IsExternalKey():
try
{
if ($this->GetValue() == 0)
{
$aValue['label'] = Dict::S('UI:UndefinedObject');