[BUGFIX] Workspace placeholder is not processed with eval-function 93/44393/3
authorOliver Hader <oliver@typo3.org>
Fri, 30 Oct 2015 12:30:21 +0000 (13:30 +0100)
committerOliver Hader <oliver.hader@typo3.org>
Fri, 30 Oct 2015 14:15:03 +0000 (15:15 +0100)
The workspace move-placeholder is not processed with the accordant
eval-function. This leads to scenario that a placeholder is not
persisted at all and produces orphaned or invalid data sets.

Resolves: #71161
Releases: master, 6.2
Change-Id: I60eaaa30399a26a10452f0605ba73476a9d129ef
Reviewed-on: https://review.typo3.org/44393
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Ralf Merz <info@merzilla.de>
Reviewed-by: Oliver Hader <oliver.hader@typo3.org>
Tested-by: Oliver Hader <oliver.hader@typo3.org>
typo3/sysext/core/Classes/DataHandling/DataHandler.php
typo3/sysext/version/Classes/Hook/DataHandlerHook.php

index 7991211..1d52c9a 100644 (file)
@@ -1385,11 +1385,16 @@ class DataHandler
      * Create a placeholder title for the label field that does match the field requirements
      *
      * @param string $table The table name
+     * @param string $placeholderContent Placeholder content to be used
      * @return string placeholder value
      */
-    protected function getPlaceholderTitleForTableLabel($table)
+    public function getPlaceholderTitleForTableLabel($table, $placeholderContent = null)
     {
-        $labelPlaceholder = '[PLACEHOLDER, WS#' . $this->BE_USER->workspace . ']';
+        if ($placeholderContent === null) {
+            $placeholderContent = 'PLACEHOLDER';
+        }
+
+        $labelPlaceholder = '[' . $placeholderContent . ', WS#' . $this->BE_USER->workspace . ']';
         $labelField = $GLOBALS['TCA'][$table]['ctrl']['label'];
         if (!isset($GLOBALS['TCA'][$table]['columns'][$labelField]['config']['eval'])) {
             return $labelPlaceholder;
index bd51ea5..f40b509 100644 (file)
@@ -1405,7 +1405,7 @@ class DataHandlerHook
             $newVersion_placeholderFieldArray['t3ver_state'] = (string)new VersionState(VersionState::MOVE_PLACEHOLDER);
             // Setting workspace - only so display of place holders can filter out those from other workspaces.
             $newVersion_placeholderFieldArray['t3ver_wsid'] = $tcemainObj->BE_USER->workspace;
-            $newVersion_placeholderFieldArray[$GLOBALS['TCA'][$table]['ctrl']['label']] = '[MOVE-TO PLACEHOLDER for #' . $uid . ', WS#' . $tcemainObj->BE_USER->workspace . ']';
+            $newVersion_placeholderFieldArray[$GLOBALS['TCA'][$table]['ctrl']['label']] = $tcemainObj->getPlaceholderTitleForTableLabel($table, 'MOVE-TO PLACEHOLDER for #' . $uid);
             // moving localized records requires to keep localization-settings for the placeholder too
             if (isset($GLOBALS['TCA'][$table]['ctrl']['languageField']) && isset($GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'])) {
                 $l10nParentRec = BackendUtility::getRecord($table, $uid);