[BUGFIX] requestUpdate sensitive to spaces 14/22314/2
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:49:30 +0000 (09:49 +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.

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

index 232631b..1663f7d 100644 (file)
@@ -140,7 +140,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'] && 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']
+                       && 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 {