[BUGFIX] Copy transOrigDiffSourceField into workspace placeholder 31/42631/4
authorMorton Jonuschat <m.jonuschat@mojocode.de>
Fri, 14 Aug 2015 18:34:18 +0000 (20:34 +0200)
committerOliver Hader <oliver.hader@typo3.org>
Sat, 22 Aug 2015 16:58:56 +0000 (18:58 +0200)
The transOrigDiffSourceField field needs to be copied into
workspace move placeholders when it exists as it can be defined
as NOT NULL in the database schema. Not copying it into the
placeholder leads to errors when MySQL is running in strict mode.

Resolves: #69073
Releases: master
Change-Id: Ifcf524675b1d6709d0d77012fdaff35017c00c90
Reviewed-on: http://review.typo3.org/42631
Reviewed-by: Oliver Hader <oliver.hader@typo3.org>
Tested-by: Oliver Hader <oliver.hader@typo3.org>
typo3/sysext/version/Classes/Hook/DataHandlerHook.php

index 2fe34d1..f05bdca 100644 (file)
@@ -1293,10 +1293,13 @@ class DataHandlerHook {
                        $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 . ']';
                        // moving localized records requires to keep localization-settings for the placeholder too
-                       if (array_key_exists('languageField', $GLOBALS['TCA'][$table]['ctrl']) && array_key_exists('transOrigPointerField', $GLOBALS['TCA'][$table]['ctrl'])) {
+                       if (isset($GLOBALS['TCA'][$table]['ctrl']['languageField']) && isset($GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'])) {
                                $l10nParentRec = BackendUtility::getRecord($table, $uid);
                                $newVersion_placeholderFieldArray[$GLOBALS['TCA'][$table]['ctrl']['languageField']] = $l10nParentRec[$GLOBALS['TCA'][$table]['ctrl']['languageField']];
                                $newVersion_placeholderFieldArray[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']] = $l10nParentRec[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']];
+                               if (isset($GLOBALS['TCA'][$table]['ctrl']['transOrigDiffSourceField'])) {
+                                       $newVersion_placeholderFieldArray[$GLOBALS['TCA'][$table]['ctrl']['transOrigDiffSourceField']] = $l10nParentRec[$GLOBALS['TCA'][$table]['ctrl']['transOrigDiffSourceField']];
+                               }
                                unset($l10nParentRec);
                        }
                        // Initially, create at root level.