diff --git a/application/cmdbabstract.class.inc.php b/application/cmdbabstract.class.inc.php index 635a662f9..04dab91bd 100644 --- a/application/cmdbabstract.class.inc.php +++ b/application/cmdbabstract.class.inc.php @@ -4,6 +4,7 @@ * @license http://opensource.org/licenses/AGPL-3.0 */ +use Combodo\iTop\Application\Helper\FormHelper; use Combodo\iTop\Application\Helper\Session; use Combodo\iTop\Application\Helper\WebResourcesHelper; use Combodo\iTop\Application\Search\SearchForm; @@ -917,11 +918,7 @@ HTML if ($bEditMode) { $sComments = isset($aFieldsComments[$sAttCode]) ? $aFieldsComments[$sAttCode] : ''; $sInfos = ''; - $iFlags = $this->GetFormAttributeFlags($sAttCode); - if (array_key_exists($sAttCode, $aExtraFlags)) { - // the caller may override some flags if needed - $iFlags = $iFlags | $aExtraFlags[$sAttCode]; - } + $iFlags = FormHelper::GetAttributeFlagsForObject($this, $sAttCode, $aExtraFlags); $bIsLinkSetWithDisplayStyleTab = is_a($oAttDef, AttributeLinkedSet::class) && $oAttDef->GetDisplayStyle() === LINKSET_DISPLAY_STYLE_TAB; if ((($iFlags & OPT_ATT_HIDDEN) == 0) && !($oAttDef instanceof AttributeDashboard) && !$bIsLinkSetWithDisplayStyleTab) { $sInputId = $this->m_iFormId.'_'.$sAttCode; @@ -3009,6 +3006,17 @@ EOF } $oPage->SetCurrentTab(''); + + // Add as hidden inputs values that we want displayed if they're readonly + if(isset($aExtraParams['forceFieldsSubmission'])){ + $aExtraFlags = $aExtraParams['fieldsFlags'] ?? []; + foreach ($aExtraParams['forceFieldsSubmission'] as $sAttCode) { + if(FormHelper::GetAttributeFlagsForObject($this, $sAttCode, $aExtraFlags) & OPT_ATT_READONLY) { + $oForm->AddSubBlock(InputUIBlockFactory::MakeForHidden('attr_'.$sPrefix.$sAttCode, $this->Get($sAttCode))); + } + } + } + $oForm->AddSubBlock(InputUIBlockFactory::MakeForHidden('class', $sClass)); $oForm->AddSubBlock(InputUIBlockFactory::MakeForHidden('transaction_id', $iTransactionId)); foreach ($aExtraParams as $sName => $value) { diff --git a/application/ui.extkeywidget.class.inc.php b/application/ui.extkeywidget.class.inc.php index 24af82c9e..9f3be25e8 100644 --- a/application/ui.extkeywidget.class.inc.php +++ b/application/ui.extkeywidget.class.inc.php @@ -4,7 +4,7 @@ * @license http://opensource.org/licenses/AGPL-3.0 */ -use Combodo\iTop\Application\Helper\LegacyFormHelper; +use Combodo\iTop\Application\Helper\FormHelper; use Combodo\iTop\Application\UI\Base\Component\Form\FormUIBlockFactory; use Combodo\iTop\Application\UI\Base\Layout\UIContentBlockUIBlockFactory; use Combodo\iTop\Core\MetaModel\FriendlyNameType; @@ -975,7 +975,7 @@ HTML ); // Remove blob edition from creation form @see N°5863 to allow blob edition in modal context - LegacyFormHelper::DisableAttributeBlobInputs($this->sTargetClass, $aFormExtraParams); + FormHelper::DisableAttributeBlobInputs($this->sTargetClass, $aFormExtraParams); cmdbAbstractObject::DisplayCreationForm($oPage, $this->sTargetClass, $oNewObj, array(), $aFormExtraParams); $oPage->add(<<vendorDir = $vendorDir; + self::initializeIncludeClosure(); } /** @@ -149,7 +153,7 @@ class ClassLoader /** * @return string[] Array of classname => path - * @psalm-var array + * @psalm-return array */ public function getClassMap() { @@ -425,7 +429,8 @@ class ClassLoader public function loadClass($class) { if ($file = $this->findFile($class)) { - includeFile($file); + $includeFile = self::$includeFile; + $includeFile($file); return true; } @@ -555,18 +560,26 @@ class ClassLoader return false; } -} -/** - * Scope isolated include. - * - * Prevents access to $this/self from included files. - * - * @param string $file - * @return void - * @private - */ -function includeFile($file) -{ - include $file; + /** + * @return void + */ + private static function initializeIncludeClosure() + { + if (self::$includeFile !== null) { + return; + } + + /** + * Scope isolated include. + * + * Prevents access to $this/self from included files. + * + * @param string $file + * @return void + */ + self::$includeFile = \Closure::bind(static function($file) { + include $file; + }, null, null); + } } diff --git a/lib/composer/autoload_classmap.php b/lib/composer/autoload_classmap.php index 00419cba8..a7f82e11e 100644 --- a/lib/composer/autoload_classmap.php +++ b/lib/composer/autoload_classmap.php @@ -2,7 +2,7 @@ // autoload_classmap.php @generated by Composer -$vendorDir = dirname(dirname(__FILE__)); +$vendorDir = dirname(__DIR__); $baseDir = dirname($vendorDir); return array( @@ -190,7 +190,7 @@ return array( 'CheckableExpression' => $baseDir . '/core/oql/oqlquery.class.inc.php', 'Combodo\\iTop\\Application\\Branding' => $baseDir . '/sources/Application/Branding.php', 'Combodo\\iTop\\Application\\EventRegister\\ApplicationEvents' => $baseDir . '/sources/Application/EventRegister/ApplicationEvents.php', - 'Combodo\\iTop\\Application\\Helper\\LegacyFormHelper' => $baseDir . '/sources/Application/Helper/LegacyFormHelper.php', + 'Combodo\\iTop\\Application\\Helper\\FormHelper' => $baseDir . '/sources/Application/Helper/FormHelper.php', 'Combodo\\iTop\\Application\\Helper\\Session' => $baseDir . '/sources/Application/Helper/Session.php', 'Combodo\\iTop\\Application\\Helper\\WebResourcesHelper' => $baseDir . '/sources/Application/Helper/WebResourcesHelper.php', 'Combodo\\iTop\\Application\\Search\\AjaxSearchException' => $baseDir . '/sources/Application/Search/ajaxsearchexception.class.inc.php', diff --git a/lib/composer/autoload_files.php b/lib/composer/autoload_files.php index 9ca87aae9..cbe23f179 100644 --- a/lib/composer/autoload_files.php +++ b/lib/composer/autoload_files.php @@ -2,24 +2,24 @@ // autoload_files.php @generated by Composer -$vendorDir = dirname(dirname(__FILE__)); +$vendorDir = dirname(__DIR__); $baseDir = dirname($vendorDir); return array( - '6e3fae29631ef280660b3cdad06f25a8' => $vendorDir . '/symfony/deprecation-contracts/function.php', 'a4a119a56e50fbb293281d9a48007e0e' => $vendorDir . '/symfony/polyfill-php80/bootstrap.php', + '6e3fae29631ef280660b3cdad06f25a8' => $vendorDir . '/symfony/deprecation-contracts/function.php', '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php', '320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php', - '0d59ee240a4cd96ddbb4ff164fccea4d' => $vendorDir . '/symfony/polyfill-php73/bootstrap.php', '23c18046f52bef3eea034657bafda50f' => $vendorDir . '/symfony/polyfill-php81/bootstrap.php', + '0d59ee240a4cd96ddbb4ff164fccea4d' => $vendorDir . '/symfony/polyfill-php73/bootstrap.php', '667aeda72477189d0494fecd327c3641' => $vendorDir . '/symfony/var-dumper/Resources/functions/dump.php', - 'e69f7f6ee287b969198c3c9d6777bd38' => $vendorDir . '/symfony/polyfill-intl-normalizer/bootstrap.php', - 'c9d07b32a2e02bc0fc582d4f0c1b56cc' => $vendorDir . '/laminas/laminas-servicemanager/src/autoload.php', '7b11c4dc42b3b3023073cb14e519683c' => $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php', - '8825ede83f2f289127722d4e842cf7e8' => $vendorDir . '/symfony/polyfill-intl-grapheme/bootstrap.php', 'c964ee0ededf28c96ebd9db5099ef910' => $vendorDir . '/guzzlehttp/promises/src/functions_include.php', - 'b6b991a57620e2fb6b2f66f03fe9ddc2' => $vendorDir . '/symfony/string/Resources/functions.php', + 'e69f7f6ee287b969198c3c9d6777bd38' => $vendorDir . '/symfony/polyfill-intl-normalizer/bootstrap.php', '37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php', + 'c9d07b32a2e02bc0fc582d4f0c1b56cc' => $vendorDir . '/laminas/laminas-servicemanager/src/autoload.php', + '8825ede83f2f289127722d4e842cf7e8' => $vendorDir . '/symfony/polyfill-intl-grapheme/bootstrap.php', '25072dd6e2470089de65ae7bf11d3109' => $vendorDir . '/symfony/polyfill-php72/bootstrap.php', 'f598d06aa772fa33d905e87be6398fb1' => $vendorDir . '/symfony/polyfill-intl-idn/bootstrap.php', + 'b6b991a57620e2fb6b2f66f03fe9ddc2' => $vendorDir . '/symfony/string/Resources/functions.php', ); diff --git a/lib/composer/autoload_namespaces.php b/lib/composer/autoload_namespaces.php index 1db5bf646..6629b7e09 100644 --- a/lib/composer/autoload_namespaces.php +++ b/lib/composer/autoload_namespaces.php @@ -2,7 +2,7 @@ // autoload_namespaces.php @generated by Composer -$vendorDir = dirname(dirname(__FILE__)); +$vendorDir = dirname(__DIR__); $baseDir = dirname($vendorDir); return array( diff --git a/lib/composer/autoload_psr4.php b/lib/composer/autoload_psr4.php index eb2c95ace..3b30be01d 100644 --- a/lib/composer/autoload_psr4.php +++ b/lib/composer/autoload_psr4.php @@ -2,7 +2,7 @@ // autoload_psr4.php @generated by Composer -$vendorDir = dirname(dirname(__FILE__)); +$vendorDir = dirname(__DIR__); $baseDir = dirname($vendorDir); return array( diff --git a/lib/composer/autoload_real.php b/lib/composer/autoload_real.php index cc554d8d1..671821bc0 100644 --- a/lib/composer/autoload_real.php +++ b/lib/composer/autoload_real.php @@ -25,46 +25,31 @@ class ComposerAutoloaderInit7f81b4a2a468a061c306af5e447a9a9f require __DIR__ . '/platform_check.php'; spl_autoload_register(array('ComposerAutoloaderInit7f81b4a2a468a061c306af5e447a9a9f', 'loadClassLoader'), true, true); - self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__))); + self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); spl_autoload_unregister(array('ComposerAutoloaderInit7f81b4a2a468a061c306af5e447a9a9f', 'loadClassLoader')); $includePaths = require __DIR__ . '/include_paths.php'; $includePaths[] = get_include_path(); set_include_path(implode(PATH_SEPARATOR, $includePaths)); - $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); - if ($useStaticLoader) { - require __DIR__ . '/autoload_static.php'; - - call_user_func(\Composer\Autoload\ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f::getInitializer($loader)); - } else { - $classMap = require __DIR__ . '/autoload_classmap.php'; - if ($classMap) { - $loader->addClassMap($classMap); - } - } + require __DIR__ . '/autoload_static.php'; + call_user_func(\Composer\Autoload\ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f::getInitializer($loader)); $loader->setClassMapAuthoritative(true); $loader->register(true); - if ($useStaticLoader) { - $includeFiles = Composer\Autoload\ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f::$files; - } else { - $includeFiles = require __DIR__ . '/autoload_files.php'; - } - foreach ($includeFiles as $fileIdentifier => $file) { - composerRequire7f81b4a2a468a061c306af5e447a9a9f($fileIdentifier, $file); + $filesToLoad = \Composer\Autoload\ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f::$files; + $requireFile = \Closure::bind(static function ($fileIdentifier, $file) { + if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { + $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; + + require $file; + } + }, null, null); + foreach ($filesToLoad as $fileIdentifier => $file) { + $requireFile($fileIdentifier, $file); } return $loader; } } - -function composerRequire7f81b4a2a468a061c306af5e447a9a9f($fileIdentifier, $file) -{ - if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { - require $file; - - $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; - } -} diff --git a/lib/composer/autoload_static.php b/lib/composer/autoload_static.php index 18165faff..a578890db 100644 --- a/lib/composer/autoload_static.php +++ b/lib/composer/autoload_static.php @@ -7,22 +7,22 @@ namespace Composer\Autoload; class ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f { public static $files = array ( - '6e3fae29631ef280660b3cdad06f25a8' => __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php', 'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php', + '6e3fae29631ef280660b3cdad06f25a8' => __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php', '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php', '320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php', - '0d59ee240a4cd96ddbb4ff164fccea4d' => __DIR__ . '/..' . '/symfony/polyfill-php73/bootstrap.php', '23c18046f52bef3eea034657bafda50f' => __DIR__ . '/..' . '/symfony/polyfill-php81/bootstrap.php', + '0d59ee240a4cd96ddbb4ff164fccea4d' => __DIR__ . '/..' . '/symfony/polyfill-php73/bootstrap.php', '667aeda72477189d0494fecd327c3641' => __DIR__ . '/..' . '/symfony/var-dumper/Resources/functions/dump.php', - 'e69f7f6ee287b969198c3c9d6777bd38' => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer/bootstrap.php', - 'c9d07b32a2e02bc0fc582d4f0c1b56cc' => __DIR__ . '/..' . '/laminas/laminas-servicemanager/src/autoload.php', '7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php', - '8825ede83f2f289127722d4e842cf7e8' => __DIR__ . '/..' . '/symfony/polyfill-intl-grapheme/bootstrap.php', 'c964ee0ededf28c96ebd9db5099ef910' => __DIR__ . '/..' . '/guzzlehttp/promises/src/functions_include.php', - 'b6b991a57620e2fb6b2f66f03fe9ddc2' => __DIR__ . '/..' . '/symfony/string/Resources/functions.php', + 'e69f7f6ee287b969198c3c9d6777bd38' => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer/bootstrap.php', '37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php', + 'c9d07b32a2e02bc0fc582d4f0c1b56cc' => __DIR__ . '/..' . '/laminas/laminas-servicemanager/src/autoload.php', + '8825ede83f2f289127722d4e842cf7e8' => __DIR__ . '/..' . '/symfony/polyfill-intl-grapheme/bootstrap.php', '25072dd6e2470089de65ae7bf11d3109' => __DIR__ . '/..' . '/symfony/polyfill-php72/bootstrap.php', 'f598d06aa772fa33d905e87be6398fb1' => __DIR__ . '/..' . '/symfony/polyfill-intl-idn/bootstrap.php', + 'b6b991a57620e2fb6b2f66f03fe9ddc2' => __DIR__ . '/..' . '/symfony/string/Resources/functions.php', ); public static $prefixLengthsPsr4 = array ( @@ -555,7 +555,7 @@ class ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f 'CheckableExpression' => __DIR__ . '/../..' . '/core/oql/oqlquery.class.inc.php', 'Combodo\\iTop\\Application\\Branding' => __DIR__ . '/../..' . '/sources/Application/Branding.php', 'Combodo\\iTop\\Application\\EventRegister\\ApplicationEvents' => __DIR__ . '/../..' . '/sources/Application/EventRegister/ApplicationEvents.php', - 'Combodo\\iTop\\Application\\Helper\\LegacyFormHelper' => __DIR__ . '/../..' . '/sources/Application/Helper/LegacyFormHelper.php', + 'Combodo\\iTop\\Application\\Helper\\FormHelper' => __DIR__ . '/../..' . '/sources/Application/Helper/FormHelper.php', 'Combodo\\iTop\\Application\\Helper\\Session' => __DIR__ . '/../..' . '/sources/Application/Helper/Session.php', 'Combodo\\iTop\\Application\\Helper\\WebResourcesHelper' => __DIR__ . '/../..' . '/sources/Application/Helper/WebResourcesHelper.php', 'Combodo\\iTop\\Application\\Search\\AjaxSearchException' => __DIR__ . '/../..' . '/sources/Application/Search/ajaxsearchexception.class.inc.php', diff --git a/lib/composer/include_paths.php b/lib/composer/include_paths.php index d4fb96718..af33c1491 100644 --- a/lib/composer/include_paths.php +++ b/lib/composer/include_paths.php @@ -2,7 +2,7 @@ // include_paths.php @generated by Composer -$vendorDir = dirname(dirname(__FILE__)); +$vendorDir = dirname(__DIR__); $baseDir = dirname($vendorDir); return array( diff --git a/sources/Application/Helper/FormHelper.php b/sources/Application/Helper/FormHelper.php new file mode 100644 index 000000000..43b78393a --- /dev/null +++ b/sources/Application/Helper/FormHelper.php @@ -0,0 +1,110 @@ + + * @author Stephen Abello + * @since 3.1.0 + * @package Combodo\iTop\Application\Helper + */ +class FormHelper +{ + /** + * DisableAttributeBlobInputs. + * + * @see N°5863 to allow blob edition in modal context. + * + * @param string $sClassName Form object class name + * @param array $aExtraParams Array extra parameters (to fill) + * + * @return void + * @throws \CoreException + */ + public static function DisableAttributeBlobInputs(string $sClassName, array &$aExtraParams): void + { + + // Initialize extra params array + if (!array_key_exists('fieldsFlags', $aExtraParams)) { + $aExtraParams['fieldsFlags'] = []; + } + if (!array_key_exists('fieldsComments', $aExtraParams)) { + $aExtraParams['fieldsComments'] = []; + } + + // Iterate throw class attributes... + foreach (MetaModel::ListAttributeDefs($sClassName) as $sAttCode => $oAttDef) { + + // Set attribute blobs in read only + if ($oAttDef instanceof AttributeBlob) { + $aExtraParams['fieldsFlags'][$sAttCode] = OPT_ATT_READONLY; + $aExtraParams['fieldsComments'][$sAttCode] = ' '; + } + } + } + + /** + * Update flags to be sent to form with url parameters + * For now only supports "readonly" param + * + * @param \DBObject $oObject + * @param array $aExtraParams + * + * @return void + * @throws \Exception + */ + public static function UpdateFlagsFromContext(DBObject $oObject, array &$aExtraParams): void + { + $aRawValues = utils::ReadParam('readonly', [], '', 'raw_data'); + $sObjectClass = get_class($oObject); + + if(array_key_exists('fieldsFlags', $aExtraParams) === false ) { + $aExtraParams['fieldsFlags'] = []; + } + + if(array_key_exists('forceFieldsSubmission', $aExtraParams) === false ) { + $aExtraParams['forceFieldsSubmission'] = []; + } + // - For each attribute present in readonly array in url, add a flag and mark them as to be submitted with their default value + foreach($aRawValues as $sAttCode => $sValue) { + if(MetaModel::IsValidAttCode($sObjectClass, $sAttCode)) { + $aExtraParams['fieldsFlags'][$sAttCode] = array_key_exists($sAttCode, $aExtraParams['fieldsFlags']) ? + $aExtraParams['fieldsFlags'][$sAttCode] & OPT_ATT_READONLY : + OPT_ATT_READONLY; + + $aExtraParams['forceFieldsSubmission'][] = $sAttCode; + } + } + } + + /** + * Get attribute flag for an object allowing to cross-check with extra flags present in a form + * + * @param \DBObject $oObject + * @param string $sAttCode + * @param array $aExtraFlags + * + * @return int + */ + public static function GetAttributeFlagsForObject(DBObject $oObject, string $sAttCode, array $aExtraFlags = []): int { + $iFlags = $oObject->GetFormAttributeFlags($sAttCode); + if (array_key_exists($sAttCode, $aExtraFlags)) { + // the caller may override some flags if needed + $iFlags |= $aExtraFlags[$sAttCode]; + } + return $iFlags; + } +} \ No newline at end of file diff --git a/sources/Application/Helper/LegacyFormHelper.php b/sources/Application/Helper/LegacyFormHelper.php deleted file mode 100644 index 08aadf741..000000000 --- a/sources/Application/Helper/LegacyFormHelper.php +++ /dev/null @@ -1,48 +0,0 @@ - $oAttDef) { - - // Set attribute blobs in read only - if ($oAttDef instanceof AttributeBlob) { - $aExtraParams['fieldsFlags'][$sAttCode] = OPT_ATT_READONLY; - $aExtraParams['fieldsComments'][$sAttCode] = ' '; - } - } - } -} \ No newline at end of file diff --git a/sources/Controller/Base/Layout/ObjectController.php b/sources/Controller/Base/Layout/ObjectController.php index b77980278..30b673b6b 100644 --- a/sources/Controller/Base/Layout/ObjectController.php +++ b/sources/Controller/Base/Layout/ObjectController.php @@ -11,7 +11,7 @@ use ApplicationContext; use ApplicationException; use cmdbAbstractObject; use CMDBObjectSet; -use Combodo\iTop\Application\Helper\LegacyFormHelper; +use Combodo\iTop\Application\Helper\FormHelper; use Combodo\iTop\Application\Helper\Session; use Combodo\iTop\Application\UI\Base\Component\Alert\AlertUIBlockFactory; use Combodo\iTop\Application\UI\Base\Component\QuickCreate\QuickCreateHelper; @@ -130,6 +130,9 @@ class ObjectController extends AbstractController $aFormExtraParams = array('wizard_container' => 1, 'keep_source_object' => true); + // - Update flags with parameters set in URL + FormHelper::UpdateFlagsFromContext($oObjToClone, $aFormExtraParams); + if ($this->IsHandlingXmlHttpRequest()) { $aFormExtraParams['js_handlers'] = []; $aFormExtraParams['noRelations'] = true; @@ -177,7 +180,7 @@ JS; } // Remove blob edition from creation form @see N°5863 to allow blob edition in modal context - LegacyFormHelper::DisableAttributeBlobInputs($sRealClass, $aFormExtraParams); + FormHelper::DisableAttributeBlobInputs($sRealClass, $aFormExtraParams); cmdbAbstractObject::DisplayCreationForm($oPage, $sRealClass, $oObjToClone, array(), $aFormExtraParams); } else { @@ -281,7 +284,7 @@ JS; JS; // Remove blob edition from creation form @see N°5863 to allow blob edition in modal context - LegacyFormHelper::DisableAttributeBlobInputs($sClass, $aFormExtraParams); + FormHelper::DisableAttributeBlobInputs($sClass, $aFormExtraParams); } else { $oPage = new iTopWebPage('', $bPrintable); diff --git a/sources/Controller/Links/LinkSetController.php b/sources/Controller/Links/LinkSetController.php index 8a81b4bb3..ec5ac169c 100644 --- a/sources/Controller/Links/LinkSetController.php +++ b/sources/Controller/Links/LinkSetController.php @@ -8,7 +8,7 @@ namespace Combodo\iTop\Controller\Links; use AjaxPage; use cmdbAbstractObject; -use Combodo\iTop\Application\Helper\LegacyFormHelper; +use Combodo\iTop\Application\Helper\FormHelper; use Combodo\iTop\Application\UI\Base\Component\Form\FormUIBlockFactory; use Combodo\iTop\Controller\AbstractController; use Combodo\iTop\Service\Router\Router; @@ -164,7 +164,7 @@ class LinkSetController extends AbstractController if ($sRealClass != '') { $oLinksetDef = MetaModel::GetAttributeDef($sClass, $sAttCode); $sExtKeyToMe = $oLinksetDef->GetExtKeyToMe(); - $aFieldFlags = array(); // TODO 3.1 array($sExtKeyToMe => OPT_ATT_READONLY); + $aFieldFlags = array($sExtKeyToMe => OPT_ATT_READONLY); $oObj = DBObject::MakeDefaultInstance($sRealClass); $oSourceObj = MetaModel::GetObject($sClass, $sId); @@ -205,6 +205,9 @@ JS 'hide_transitions' => true, 'formPrefix' => $sAttCode, 'fieldsFlags' => $aFieldFlags, + 'forceFieldsSubmission' => [ + $sExtKeyToMe + ], 'js_handlers' => [ 'form_on_submit' => $sFormOnSubmitJsCode, 'cancel_button_on_click' => @@ -218,7 +221,7 @@ JS ]; // Remove blob edition from creation form @see N°5863 to allow blob edition in modal context - LegacyFormHelper::DisableAttributeBlobInputs($sRealClass, $aExtraParams); + FormHelper::DisableAttributeBlobInputs($sRealClass, $aExtraParams); cmdbAbstractObject::DisplayCreationForm($oPage, $sRealClass, $oObj, array(), $aExtraParams); }