|
@@ -32,6 +32,9 @@ use \DBObject;
|
|
use \DBObjectSet;
|
|
use \DBObjectSet;
|
|
use \DBSearch;
|
|
use \DBSearch;
|
|
use \DBObjectSearch;
|
|
use \DBObjectSearch;
|
|
|
|
+use \BinaryExpression;
|
|
|
|
+use \FieldExpression;
|
|
|
|
+use \ScalarExpression;
|
|
use \DBObjectSetComparator;
|
|
use \DBObjectSetComparator;
|
|
use \InlineImage;
|
|
use \InlineImage;
|
|
use \AttributeDateTime;
|
|
use \AttributeDateTime;
|
|
@@ -705,6 +708,23 @@ class ObjectFormManager extends FormManager
|
|
$oField->SetSearch($oScopeOriginal);
|
|
$oField->SetSearch($oScopeOriginal);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ // - Field that require to check if the current value is among allowed ones
|
|
|
|
+ if (in_array(get_class($oField), array('Combodo\\iTop\\Form\\Field\\SelectObjectField')))
|
|
|
|
+ {
|
|
|
|
+ // 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 )
|
|
|
|
+ {
|
|
|
|
+ $oField->SetCurrentValue(null);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
// - Field that require processing on their subfields
|
|
// - Field that require processing on their subfields
|
|
if (in_array(get_class($oField), array('Combodo\\iTop\\Form\\Field\\SubFormField')))
|
|
if (in_array(get_class($oField), array('Combodo\\iTop\\Form\\Field\\SubFormField')))
|
|
{
|
|
{
|