From 3347d32f2a697261af16cefd179602c66f083044 Mon Sep 17 00:00:00 2001 From: steffunky Date: Tue, 9 Oct 2018 18:25:48 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B01555:=20fixed=20a=20case=20where=20Attri?= =?UTF-8?q?buteExternal=20field=20was=20pointing=20anything=20else=20than?= =?UTF-8?q?=20an=20ExternalKey=20and=20its=20label=20wouldn't=20show=20up?= =?UTF-8?q?=20on=20search=20criteria?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/oql/expression.class.inc.php | 35 ++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/core/oql/expression.class.inc.php b/core/oql/expression.class.inc.php index 5c8d34335..e4b30c05a 100644 --- a/core/oql/expression.class.inc.php +++ b/core/oql/expression.class.inc.php @@ -917,24 +917,35 @@ class ScalarExpression extends UnaryExpression case ($oAttDef instanceof AttributeExternalField): try { - if ($this->GetValue() != 0) + $oFinalAttDef = $oAttDef->GetFinalAttDef(); + if($oFinalAttDef instanceof AttributeExternalKey) { - /** @var AttributeExternalKey $oAttDef */ - $sTarget = $oAttDef->GetFinalAttDef()->GetTargetClass(); - $oObj = MetaModel::GetObject($sTarget, $this->GetValue()); - - $aValue['label'] = $oObj->Get("friendlyname"); - $aValue['value'] = $this->GetValue(); - $aCriterion['values'] = array($aValue); - + if ($this->GetValue() !== 0) + { + /** @var AttributeExternalKey $oFinalAttDef */ + $sTarget = $oFinalAttDef->GetTargetClass(); + $oObj = MetaModel::GetObject($sTarget, $this->GetValue()); + $aValue['label'] = $oObj->Get("friendlyname"); + $aValue['value'] = $this->GetValue(); + } + else + { + $aValue['label'] = Dict::S('Enum:Undefined'); + $aValue['value'] = $this->GetValue(); + } } else { - $aValue['label'] = Dict::S('Enum:Undefined'); + $aValue['label'] = $this->GetValue(); $aValue['value'] = $this->GetValue(); - $aCriterion['values'] = array($aValue); } - } catch (Exception $e) + $aCriterion['values'] = array($aValue); + } + catch (Exception $e) + { + IssueLog::Error($e->getMessage()); + } + catch (Exception $e) { IssueLog::Error($e->getMessage()); }