[BUGFIX] Pass field name variable to flexform DS utility 90/30890/2
authorClaus Due <claus@namelesscoder.net>
Mon, 9 Jun 2014 21:30:37 +0000 (23:30 +0200)
committerMarkus Klein <klein.t3@mfc-linz.at>
Thu, 19 Jun 2014 19:34:57 +0000 (21:34 +0200)
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/30890
Reviewed-by: Markus Klein
Tested-by: Markus Klein
typo3/sysext/backend/Classes/Form/Element/SuggestElement.php
typo3/sysext/core/Classes/DataHandling/DataHandler.php
typo3/sysext/impexp/Classes/ImportExport.php

index 76258a6..d3db8ab 100644 (file)
@@ -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;
index 0bd8877..2aac84c 100644 (file)
@@ -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');
index cecea21..3460a85 100644 (file)
@@ -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 */