[BUGFIX] FormEngine: Only evaluate Flexform display conditions once 44/43744/5
authorStefan Froemken <froemken@gmail.com>
Fri, 2 Oct 2015 14:39:37 +0000 (16:39 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sat, 3 Oct 2015 01:10:58 +0000 (03:10 +0200)
Avoid evaluating the display conditions for fields on a Flexform sheet
more than once. Multiple evaluations of the same conditions can lead to
wrong result due to fields having been removed by the first evaluation.

Resolves: #70314
Releases: master
Change-Id: I412a8cc2acf67e2a72de1f37a0f8038110ca4c2e
Reviewed-on: http://review.typo3.org/43744
Reviewed-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Tested-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/backend/Classes/Form/FormDataProvider/EvaluateDisplayConditions.php
typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/EvaluateDisplayConditionsTest.php

index af0c25d..4eabbcd 100644 (file)
@@ -115,8 +115,8 @@ class EvaluateDisplayConditions implements FormDataProviderInterface {
                        foreach ($result['processedTca']['columns'][$columnName]['config']['ds']['sheets'] as $sheetName => $sheetConfiguration) {
                                $flexFormSheetRowData = $flexFormRowData[$sheetName]['lDEF'];
                                $flexFormSheetRowData['parentRec'] = $result['databaseRow'];
-                               $result['processedTca']['columns'][$columnName]['config']['ds']['sheets'] = $this->removeFlexformFieldsRecursive(
-                                       $result['processedTca']['columns'][$columnName]['config']['ds']['sheets'],
+                               $result['processedTca']['columns'][$columnName]['config']['ds']['sheets'][$sheetName] = $this->removeFlexformFieldsRecursive(
+                                       $result['processedTca']['columns'][$columnName]['config']['ds']['sheets'][$sheetName],
                                        $flexFormSheetRowData
                                );
                        }
index d9fe493..9d5a717 100644 (file)
@@ -222,10 +222,32 @@ class EvaluateDisplayConditionsTest extends UnitTestCase {
                                                                                                                'items' => [],
                                                                                                        ],
                                                                                                ],
+                                                                                               'mmUseCurl' => [
+                                                                                                       'displayCond' => 'FIELD:mmType:=:audio',
+                                                                                                       'config' => [
+                                                                                                               'type' => 'check',
+                                                                                                               'default' => '0',
+                                                                                                               'items' => [],
+                                                                                                       ],
+                                                                                               ],
                                                                                        ],
                                                                                        'sheetTitle' => 'aTitle',
                                                                                ],
                                                                        ],
+                                                                       'secondSheet' => [
+                                                                               'ROOT' => [
+                                                                                       'type' => 'array',
+                                                                                       'el' => [
+                                                                                               'foo' => [
+                                                                                                       'config' => [
+                                                                                                               'type' => 'select',
+                                                                                                               'items' => [],
+                                                                                                       ],
+                                                                                               ],
+                                                                                       ],
+                                                                                       'sheetTitle' => 'bTitle',
+                                                                               ],
+                                                                       ],
                                                                ],
                                                        ],
                                                ],