From 4436848eddfd2d18bacfa372ec705da19c769ce4 Mon Sep 17 00:00:00 2001 From: Claus Due <claus@namelesscoder.net> Date: Mon, 9 Jun 2014 23:30:37 +0200 Subject: [PATCH] [BUGFIX] Pass field name variable to flexform DS utility A field name parameter is not being passed from within DataHandler when copying a record which has a FlexForm DF associated with it. This causes dynamic FlexForm DS definitions to not be able to depend on the field name, in turn causing the problem that an incorrect DS may be returned from the DS utility which makes TYPO3 process the data value incorrectly (for example, not detecting file fields and processing the values accordingly). To solve this the $field parameter is passed. Resolves: #59423 Releases: 6.3, 6.2, 6.1 Change-Id: Icfafd553f76e17ad5db651bb3f5dea52b140dcf7 Reviewed-on: https://review.typo3.org/30633 Reviewed-by: Cedric Ziel Tested-by: Cedric Ziel Reviewed-by: Markus Klein Tested-by: Markus Klein --- .../backend/Classes/Form/Element/SuggestElement.php | 2 +- typo3/sysext/core/Classes/DataHandling/DataHandler.php | 8 ++++---- typo3/sysext/impexp/Classes/ImportExport.php | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/typo3/sysext/backend/Classes/Form/Element/SuggestElement.php b/typo3/sysext/backend/Classes/Form/Element/SuggestElement.php index 76258a6ca434..d3db8abad15a 100644 --- a/typo3/sysext/backend/Classes/Form/Element/SuggestElement.php +++ b/typo3/sysext/backend/Classes/Form/Element/SuggestElement.php @@ -172,7 +172,7 @@ class SuggestElement { if ($GLOBALS['TCA'][$table]['columns'][$parts[0]]['config']['type'] === 'flex') { if (is_array($row) && count($row) > 0) { $flexfieldTCAConfig = $GLOBALS['TCA'][$table]['columns'][$parts[0]]['config']; - $flexformDSArray = BackendUtility::getFlexFormDS($flexfieldTCAConfig, $row, $table); + $flexformDSArray = BackendUtility::getFlexFormDS($flexfieldTCAConfig, $row, $table, $parts[0]); $flexformDSArray = GeneralUtility::resolveAllSheetsInDS($flexformDSArray); $flexformElement = $parts[count($parts) - 2]; $continue = TRUE; diff --git a/typo3/sysext/core/Classes/DataHandling/DataHandler.php b/typo3/sysext/core/Classes/DataHandling/DataHandler.php index 0bd887707473..2aac84c68886 100644 --- a/typo3/sysext/core/Classes/DataHandling/DataHandler.php +++ b/typo3/sysext/core/Classes/DataHandling/DataHandler.php @@ -3448,7 +3448,7 @@ class DataHandler { // For "flex" fieldtypes we need to traverse the structure for two reasons: If there are file references they have to be prepended with absolute paths and if there are database reference they MIGHT need to be remapped (still done in remapListedDBRecords()) if ($conf['type'] == 'flex') { // Get current value array: - $dataStructArray = BackendUtility::getFlexFormDS($conf, $row, $table); + $dataStructArray = BackendUtility::getFlexFormDS($conf, $row, $table, $field); $currentValueArray = GeneralUtility::xml2array($value); // Traversing the XML structure, processing files: if (is_array($currentValueArray)) { @@ -4852,13 +4852,13 @@ class DataHandler { } } elseif ($conf['type'] == 'flex') { // Current record - $dataStructArray = BackendUtility::getFlexFormDS($conf, $currentRec, $table); + $dataStructArray = BackendUtility::getFlexFormDS($conf, $currentRec, $table, $field); $currentValueArray = GeneralUtility::xml2array($currentRec[$field]); if (is_array($currentValueArray)) { $this->checkValue_flex_procInData($currentValueArray['data'], array(), array(), $dataStructArray, array($table, $id, $field), 'version_remapMMForVersionSwap_flexFormCallBack'); } // Swap record - $dataStructArray = BackendUtility::getFlexFormDS($conf, $swapRec, $table); + $dataStructArray = BackendUtility::getFlexFormDS($conf, $swapRec, $table, $field); $currentValueArray = GeneralUtility::xml2array($swapRec[$field]); if (is_array($currentValueArray)) { $this->checkValue_flex_procInData($currentValueArray['data'], array(), array(), $dataStructArray, array($table, $swapWith, $field), 'version_remapMMForVersionSwap_flexFormCallBack'); @@ -4981,7 +4981,7 @@ class DataHandler { if (is_array($origRecordRow)) { BackendUtility::workspaceOL($table, $origRecordRow); // Get current data structure and value array: - $dataStructArray = BackendUtility::getFlexFormDS($conf, $origRecordRow, $table); + $dataStructArray = BackendUtility::getFlexFormDS($conf, $origRecordRow, $table, $fieldName); $currentValueArray = GeneralUtility::xml2array($origRecordRow[$fieldName]); // Do recursive processing of the XML data: $currentValueArray['data'] = $this->checkValue_flex_procInData($currentValueArray['data'], array(), array(), $dataStructArray, array($table, $theUidToUpdate, $fieldName), 'remapListedDBRecords_flexFormCallBack'); diff --git a/typo3/sysext/impexp/Classes/ImportExport.php b/typo3/sysext/impexp/Classes/ImportExport.php index cecea212549c..3460a85c8821 100644 --- a/typo3/sysext/impexp/Classes/ImportExport.php +++ b/typo3/sysext/impexp/Classes/ImportExport.php @@ -2301,7 +2301,7 @@ class ImportExport { $conf = $GLOBALS['TCA'][$table]['columns'][$field]['config']; if (is_array($origRecordRow) && is_array($conf) && $conf['type'] === 'flex') { // Get current data structure and value array: - $dataStructArray = BackendUtility::getFlexFormDS($conf, $origRecordRow, $table); + $dataStructArray = BackendUtility::getFlexFormDS($conf, $origRecordRow, $table, $field); $currentValueArray = GeneralUtility::xml2array($updateData[$table][$thisNewUid][$field]); // Do recursive processing of the XML data: $iteratorObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\DataHandling\\DataHandler'); @@ -2409,7 +2409,7 @@ class ImportExport { $origRecordRow = BackendUtility::getRecord($table, $thisNewUid, '*'); if (is_array($origRecordRow)) { // Get current data structure and value array: - $dataStructArray = BackendUtility::getFlexFormDS($conf, $origRecordRow, $table); + $dataStructArray = BackendUtility::getFlexFormDS($conf, $origRecordRow, $table, $field); $currentValueArray = GeneralUtility::xml2array($origRecordRow[$field]); // Do recursive processing of the XML data: /** @var $iteratorObj \TYPO3\CMS\Core\DataHandling\DataHandler */ -- GitLab