mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-12 23:14:18 +01:00
N°6385 - Allow to disable LinkedSet (1:n & n:n) edition by XML
Co-authored-by: Molkobain <lajarige.guillaume@free.fr>
This commit is contained in:
@@ -938,6 +938,30 @@ EOF
|
||||
return $aXmlToPHP[$sEditMode];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Helper to format the edit-when for direct linkset
|
||||
*
|
||||
* @param string $sEditWhen Value set from within the XML
|
||||
* @return string PHP flag
|
||||
*
|
||||
* @throws \DOMFormatException
|
||||
*/
|
||||
protected function EditWhenToPHP($sEditWhen): string
|
||||
{
|
||||
static $aXmlToPHP = array(
|
||||
'never' => 'LINKSET_EDITWHEN_NEVER',
|
||||
'on_host_edition' => 'LINKSET_EDITWHEN_ON_HOST_EDITION',
|
||||
'on_host_display' => 'LINKSET_EDITWHEN_ON_HOST_DISPLAY',
|
||||
'always' => 'LINKSET_EDITWHEN_ALWAYS',
|
||||
);
|
||||
|
||||
if (!array_key_exists($sEditWhen, $aXmlToPHP))
|
||||
{
|
||||
throw new DOMFormatException("Edit mode: unknown value '$sEditWhen'");
|
||||
}
|
||||
return $aXmlToPHP[$sEditWhen];
|
||||
}
|
||||
|
||||
/**
|
||||
* Format a path (file or url) as an absolute path or relative to the module or the app
|
||||
@@ -2054,6 +2078,7 @@ EOF
|
||||
$this->CompileCommonProperty('duplicates', $oField, $aParameters, $sModuleRelativeDir, false);
|
||||
$this->CompileCommonProperty('display_style', $oField, $aParameters, $sModuleRelativeDir);
|
||||
$this->CompileCommonProperty('edit_mode', $oField, $aParameters, $sModuleRelativeDir);
|
||||
$this->CompileCommonProperty('edit_when', $oField, $aParameters, $sModuleRelativeDir);
|
||||
$this->CompileCommonProperty('filter', $oField, $aParameters, $sModuleRelativeDir);
|
||||
$this->CompileCommonProperty('with_php_constraint', $oField, $aParameters, $sModuleRelativeDir, false);
|
||||
$aParameters['depends_on'] = $sDependencies;
|
||||
@@ -2064,6 +2089,7 @@ EOF
|
||||
$this->CompileCommonProperty('count_max', $oField, $aParameters, $sModuleRelativeDir, 0);
|
||||
$this->CompileCommonProperty('display_style', $oField, $aParameters, $sModuleRelativeDir);
|
||||
$this->CompileCommonProperty('edit_mode', $oField, $aParameters, $sModuleRelativeDir);
|
||||
$this->CompileCommonProperty('edit_when', $oField, $aParameters, $sModuleRelativeDir);
|
||||
$this->CompileCommonProperty('filter', $oField, $aParameters, $sModuleRelativeDir);
|
||||
$this->CompileCommonProperty('with_php_constraint', $oField, $aParameters, $sModuleRelativeDir, false);
|
||||
$aParameters['depends_on'] = $sDependencies;
|
||||
@@ -2289,6 +2315,12 @@ EOF
|
||||
$aParameters['edit_mode'] = $this->EditModeToPHP($sEditMode);
|
||||
}
|
||||
break;
|
||||
case 'edit_when':
|
||||
$sEditWhen = $oField->GetChildText('edit_when');
|
||||
if(!is_null($sEditWhen)){
|
||||
$aParameters['edit_when'] = $this->EditWhenToPHP($sEditWhen);
|
||||
}
|
||||
break;
|
||||
case 'mappings':
|
||||
$oMappings = $oField->GetUniqueElement('mappings');
|
||||
$oMappingNodes = $oMappings->getElementsByTagName('mapping');
|
||||
|
||||
Reference in New Issue
Block a user