mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
N°3678 - Portal : a modification of field cannot hide another one
This commit is contained in:
@@ -78,6 +78,12 @@ class ObjectFormManager extends FormManager
|
|||||||
protected $aFormProperties;
|
protected $aFormProperties;
|
||||||
/** @var array $aCallbackUrls */
|
/** @var array $aCallbackUrls */
|
||||||
protected $aCallbackUrls = array();
|
protected $aCallbackUrls = array();
|
||||||
|
/**
|
||||||
|
* List of hidden fields, used for form update (eg. remove them from the form regarding they dependencies)
|
||||||
|
* @var array $aHiddenFieldsId
|
||||||
|
* @since 2.7.5
|
||||||
|
*/
|
||||||
|
protected $aHiddenFieldsId = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an instance of \Combodo\iTop\Portal\Form\ObjectFormManager from JSON data that must contain at least :
|
* Creates an instance of \Combodo\iTop\Portal\Form\ObjectFormManager from JSON data that must contain at least :
|
||||||
@@ -941,6 +947,8 @@ class ObjectFormManager extends FormManager
|
|||||||
if($oField->GetHidden() === false)
|
if($oField->GetHidden() === false)
|
||||||
{
|
{
|
||||||
$oForm->AddField($oField);
|
$oForm->AddField($oField);
|
||||||
|
} else {
|
||||||
|
$this->aHiddenFieldsId[]=$oField->GetId();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1472,4 +1480,22 @@ class ObjectFormManager extends FormManager
|
|||||||
}
|
}
|
||||||
return $oChangeOp;
|
return $oChangeOp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
* @since 2.7.5
|
||||||
|
*/
|
||||||
|
public function GetHiddenFieldsId()
|
||||||
|
{
|
||||||
|
return $this->aHiddenFieldsId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array $aHiddenFieldsId
|
||||||
|
* @since 2.7.5
|
||||||
|
*/
|
||||||
|
public function SetHiddenFieldsId($aHiddenFieldsId)
|
||||||
|
{
|
||||||
|
$this->aHiddenFieldsId = $aHiddenFieldsId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -280,8 +280,8 @@ class ObjectFormHandlerHelper
|
|||||||
->SetFormProperties($aFormProperties);
|
->SetFormProperties($aFormProperties);
|
||||||
|
|
||||||
$oFormManager->Build();
|
$oFormManager->Build();
|
||||||
|
$aFormData['hidden_fields'] = $oFormManager->GetHiddenFieldsId();
|
||||||
// Check the number of editable fields
|
// Check the number of editable fields
|
||||||
$aFormData['editable_fields_count'] = $oFormManager->GetForm()->GetEditableFieldCount();
|
$aFormData['editable_fields_count'] = $oFormManager->GetForm()->GetEditableFieldCount();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -388,6 +388,7 @@ class ObjectFormHandlerHelper
|
|||||||
$aFormData['object_state'] = $oFormManager->GetObject()->GetState();
|
$aFormData['object_state'] = $oFormManager->GetObject()->GetState();
|
||||||
$aFormData['fieldset'] = $aFieldSetData;
|
$aFormData['fieldset'] = $aFieldSetData;
|
||||||
$aFormData['display_mode'] = (isset($aFormProperties['properties'])) ? $aFormProperties['properties']['display_mode'] : ApplicationHelper::FORM_DEFAULT_DISPLAY_MODE;
|
$aFormData['display_mode'] = (isset($aFormProperties['properties'])) ? $aFormProperties['properties']['display_mode'] : ApplicationHelper::FORM_DEFAULT_DISPLAY_MODE;
|
||||||
|
$aFormData['hidden_fields'] = $oFormManager->GetHiddenFieldsId();
|
||||||
// - Set a text to be copied on title if the object is not in creation
|
// - Set a text to be copied on title if the object is not in creation
|
||||||
if($sMode !== static::ENUM_MODE_CREATE && !empty($sObjectId))
|
if($sMode !== static::ENUM_MODE_CREATE && !empty($sObjectId))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -151,9 +151,16 @@ $(function()
|
|||||||
// Intended for overloading in derived classes
|
// Intended for overloading in derived classes
|
||||||
_onUpdateSuccess: function(oData, sFormPath)
|
_onUpdateSuccess: function(oData, sFormPath)
|
||||||
{
|
{
|
||||||
|
var me = this;
|
||||||
|
if(oData.form.hidden_fields !== undefined)
|
||||||
|
{
|
||||||
|
$.each(oData.form.hidden_fields, function( index, value ) {
|
||||||
|
me.element.find('[data-form-path="' + sFormPath + '"][data-field-id="'+value+'"][data-attribute-flag-hidden="false"]').remove();
|
||||||
|
});
|
||||||
|
}
|
||||||
if(oData.form.updated_fields !== undefined)
|
if(oData.form.updated_fields !== undefined)
|
||||||
{
|
{
|
||||||
this.element.find('[data-form-path="' + sFormPath + '"]').trigger('update_form', {updated_fields: oData.form.updated_fields});
|
me.element.find('[data-form-path="' + sFormPath + '"]').trigger('update_form', {updated_fields: oData.form.updated_fields});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// Intended for overloading in derived classes
|
// Intended for overloading in derived classes
|
||||||
|
|||||||
Reference in New Issue
Block a user