[BUGFIX] Compare field names without configuration 10/38610/2
authorNicole Cordes <typo3@cordes.co>
Wed, 8 Apr 2015 09:13:07 +0000 (11:13 +0200)
committerXavier Perseguers <xavier@typo3.org>
Fri, 10 Apr 2015 08:36:48 +0000 (10:36 +0200)
With patch https://review.typo3.org/34019/ the function
ExtensionManagementUtility::removeDuplicatesForInsertion was rewritten.
But the rewrite fails for fields with additional configuration and
returns wrong field information.

Resolves: #65480
Releases: master, 6.2
Change-Id: I9aa35cd7ef5142e7b57489bf6e19a78811b8c335
Reviewed-on: http://review.typo3.org/38528
Reviewed-by: Markus Klein <klein.t3@reelworx.at>
Tested-by: Markus Klein <klein.t3@reelworx.at>
Reviewed-by: Xavier Perseguers <xavier@typo3.org>
Tested-by: Xavier Perseguers <xavier@typo3.org>
Reviewed-on: http://review.typo3.org/38610

typo3/sysext/core/Classes/Utility/ExtensionManagementUtility.php
typo3/sysext/core/Tests/Unit/Utility/ExtensionManagementUtilityTest.php

index 8ee6ce6..6eb2bfc 100644 (file)
@@ -652,7 +652,15 @@ class ExtensionManagementUtility {
 
                $cleanInsertionListParts = array();
                foreach ($insertionListParts as $fieldName) {
-                       if ($fieldName == '--linebreak--' || (!in_array($fieldName, $cleanInsertionListParts) && !in_array($fieldName, $listMatches))) {
+                       $fieldNameParts = explode(';', $fieldName, 2);
+                       $cleanFieldName = $fieldNameParts[0];
+                       if (
+                               $cleanFieldName === '--linebreak--'
+                               || (
+                                       !in_array($cleanFieldName, $cleanInsertionListParts, TRUE)
+                                       && !in_array($cleanFieldName, $listMatches, TRUE)
+                               )
+                       ) {
                                $cleanInsertionListParts[] = $fieldName;
                        }
                }
index 58e7933..2aaa4db 100644 (file)
@@ -507,6 +507,16 @@ class ExtensionManagementUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
                                'field_a, field_b, --linebreak--, field_c',
                                '--linebreak--, field_d, --linebreak--'
                        ),
+                       'with configuration in list' => array(
+                               'field_b, field_d, field_c;;;4-4-4',
+                               'field_a, field_b;;;;2-2-2, field_c;;;;3-3-3',
+                               'field_d',
+                       ),
+                       'with configuration in list and insertion list' => array(
+                               'field_b, field_d;;;3-3-3, field_c;;;4-4-4',
+                               'field_a, field_b;;;;2-2-2, field_c;;;;3-3-3',
+                               'field_d;;;3-3-3',
+                       ),
                );
        }