[BUGFIX] requestUpdate sensitive to spaces 10/22310/3
authorWouter Wolters <typo3@wouterwolters.nl>
Sat, 13 Jul 2013 17:26:28 +0000 (19:26 +0200)
committerMarkus Klein <klein.t3@mfc-linz.at>
Mon, 15 Jul 2013 07:50:08 +0000 (09:50 +0200)
The TCA property "requestUpdate" is sensitive to spaces, although this
is documented nowhere. Indeed "foo1, foo2" will not work whereas
"foo1,foo2" does. This patch strips spaces from the "requestUpdate"
string before testing it.

Change-Id: Ifbb1fe5be59077207316e48204d65a978592f878
Resolves: #49872
Related: #42789
Releases: 6.2, 6.1, 6.0, 4.7, 4.5
Reviewed-on: https://review.typo3.org/22310
Reviewed-by: Markus Klein
Tested-by: Markus Klein
typo3/sysext/backend/Classes/Form/Element/TreeElement.php

index 6dbeb37..e13f17b 100644 (file)
@@ -137,7 +137,12 @@ class TreeElement {
                }
                // Create a JavaScript code line which will ask the user to save/update the form due to changing the element.
                // This is used for eg. "type" fields and others configured with "requestUpdate"
-               if ($GLOBALS['TCA'][$table]['ctrl']['type'] && !strcmp($field, $GLOBALS['TCA'][$table]['ctrl']['type']) || $GLOBALS['TCA'][$table]['ctrl']['requestUpdate'] && \TYPO3\CMS\Core\Utility\GeneralUtility::inList($GLOBALS['TCA'][$table]['ctrl']['requestUpdate'], $field)) {
+               if (
+                       $GLOBALS['TCA'][$table]['ctrl']['type']
+                       && !strcmp($field, $GLOBALS['TCA'][$table]['ctrl']['type'])
+                       || $GLOBALS['TCA'][$table]['ctrl']['requestUpdate']
+                       && \TYPO3\CMS\Core\Utility\GeneralUtility::inList(str_replace(' ', '', $GLOBALS['TCA'][$table]['ctrl']['requestUpdate']), $field)
+               ) {
                        if ($GLOBALS['BE_USER']->jsConfirmation(1)) {
                                $onChange .= 'if (confirm(TBE_EDITOR.labels.onChangeAlert) && ' . 'TBE_EDITOR.checkSubmit(-1)){ TBE_EDITOR.submitForm() };';
                        } else {
@@ -204,4 +209,4 @@ class TreeElement {
 }
 
 
-?>
\ No newline at end of file
+?>