mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 11:08:45 +02:00
N°844 Portal: ExternalField support in forms was not properly supporting external key as readonly.
SVN:trunk[4873]
This commit is contained in:
@@ -5085,15 +5085,31 @@ class AttributeExternalField extends AttributeDefinition
|
|||||||
|
|
||||||
public function MakeFormField(DBObject $oObject, $oFormField = null)
|
public function MakeFormField(DBObject $oObject, $oFormField = null)
|
||||||
{
|
{
|
||||||
if ($oFormField === null)
|
// Retrieving AttDef from the remote attribute
|
||||||
|
$oRemoteAttDef = $this->GetExtAttDef();
|
||||||
|
|
||||||
|
if ($oFormField === null)
|
||||||
{
|
{
|
||||||
// ExternalField's FormField are actually based on the FormField from the target attribute.
|
// ExternalField's FormField are actually based on the FormField from the target attribute.
|
||||||
$oRemoteAttDef = $this->GetExtAttDef();
|
// Except for the AttributeExternalKey because we have no OQL and stuff
|
||||||
$sFormFieldClass = $oRemoteAttDef::GetFormFieldClass();
|
if($oRemoteAttDef instanceof AttributeExternalKey)
|
||||||
|
{
|
||||||
|
$sFormFieldClass = static::GetFormFieldClass();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$sFormFieldClass = $oRemoteAttDef::GetFormFieldClass();
|
||||||
|
}
|
||||||
$oFormField = new $sFormFieldClass($this->GetCode());
|
$oFormField = new $sFormFieldClass($this->GetCode());
|
||||||
}
|
}
|
||||||
parent::MakeFormField($oObject, $oFormField);
|
parent::MakeFormField($oObject, $oFormField);
|
||||||
|
|
||||||
|
// Manually setting for remote ExternalKey, otherwise, the id would be displayed.
|
||||||
|
if($oRemoteAttDef instanceof AttributeExternalKey)
|
||||||
|
{
|
||||||
|
$oFormField->SetCurrentValue($oObject->Get($this->GetCode().'_friendlyname'));
|
||||||
|
}
|
||||||
|
|
||||||
// Readonly field because we can't update external fields
|
// Readonly field because we can't update external fields
|
||||||
$oFormField->SetReadOnly(true);
|
$oFormField->SetReadOnly(true);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user