From 59ebc49d46bfc6f79cd2ab39079fdd3c8dfe4622 Mon Sep 17 00:00:00 2001 From: Guillaume Lajarige Date: Thu, 5 Oct 2017 09:48:29 +0000 Subject: [PATCH] =?UTF-8?q?N=C2=B01025=20Portal:=20Fixed=20regression=20in?= =?UTF-8?q?troduced=20in=20r4863.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SVN:trunk[4966] --- .../src/forms/objectformmanager.class.inc.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/datamodels/2.x/itop-portal-base/portal/src/forms/objectformmanager.class.inc.php b/datamodels/2.x/itop-portal-base/portal/src/forms/objectformmanager.class.inc.php index f4597bd71..379da9cde 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/forms/objectformmanager.class.inc.php +++ b/datamodels/2.x/itop-portal-base/portal/src/forms/objectformmanager.class.inc.php @@ -714,15 +714,18 @@ class ObjectFormManager extends FormManager // Note: We can't do this in AttributeExternalKey::MakeFormField() in the Field::SetOnFinalizeCallback() because at this point we have no information about the portal scope and ignore_silos flag, hence it always applies silos. // As a workaround we have to manually check if the field's current value is among the scope - /** @var DBObjectSearch $oValuesScope */ - $oValuesScope = $oField->GetSearch()->DeepClone(); - $oBinaryExp = new BinaryExpression(new FieldExpression('id', $oValuesScope->GetClassAlias()), '=', new ScalarExpression( $oField->GetCurrentValue() )); - $oValuesScope->AddConditionExpression($oBinaryExp); - $oValuesSet = new DBObjectSet($oValuesScope); - - if( $oValuesSet->Count() === 0 ) + if(!$oField->GetReadOnly()) { - $oField->SetCurrentValue(null); + /** @var DBObjectSearch $oValuesScope */ + $oValuesScope = $oField->GetSearch()->DeepClone(); + $oBinaryExp = new BinaryExpression(new FieldExpression('id', $oValuesScope->GetClassAlias()), '=', new ScalarExpression($oField->GetCurrentValue())); + $oValuesScope->AddConditionExpression($oBinaryExp); + $oValuesSet = new DBObjectSet($oValuesScope); + + if($oValuesSet->Count() === 0) + { + $oField->SetCurrentValue(null); + } } } // - Field that require processing on their subfields