Project

General

Profile

Actions

Bug #99985

closed

DataHandler: transOrigDiffSourceField not written on translation initialization

Added by Markus Hofmann almost 2 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Should have
Category:
DataHandler aka TCEmain
Target version:
-
Start date:
2023-02-19
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
11
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

When creating a translation, DataHandler copies the record and adds some defaults from original source.

During copying, method fillInFieldArray writes correct data to

$originalLanguage_diffStorage.

Unfortunately, the original content from transOrigDiffSourceField is copied to the $fieldArray. This is useful for history/undo, as described later, but with this behaviour it's not possible to detect changes from source in translation, when translation record is only created and not saved again. A save after creation will fill in diffsource correctly.

To allow adding the diffsource to newly created records without changing the other behaviour, it should managed, that the if-construct checking the write allowed, should check for

strpos((string)$id, 'NEW') !== false

too.

I tested with following setups, all the same behaviour:

  • php 7.4
  • nginx

Affected TYPO3 versions:

  • 9 ELTS
  • 10 old LTS
  • 11 LTS

untested, but should be affected, too:

  • v12

I guess, this part should be changed


        // Add diff-storage information:
        if ($diffStorageFlag
            && !array_key_exists($GLOBALS['TCA'][$table]['ctrl']['transOrigDiffSourceField'], $fieldArray)
        ) {
            // If the field is set it would probably be because of an undo-operation - in which case we should not update the field of course...
            $fieldArray[$GLOBALS['TCA'][$table]['ctrl']['transOrigDiffSourceField']] = serialize($originalLanguage_diffStorage);
        }

to this

// Add diff-storage information:
        if (
            $diffStorageFlag
            && (
                !array_key_exists($GLOBALS['TCA'][$table]['ctrl']['transOrigDiffSourceField'], $fieldArray)
            || strpos((string)$id, 'NEW') !== false
            )
        ) {
            // If the field is set it would probably be because of an undo-operation - in which case we should not update the field of course...
            $fieldArray[$GLOBALS['TCA'][$table]['ctrl']['transOrigDiffSourceField']] = serialize($originalLanguage_diffStorage);
        }
Actions #1

Updated by Gerrit Code Review almost 2 years ago

  • Status changed from New to Under Review

Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/77895

Actions #2

Updated by Gerrit Code Review almost 2 years ago

Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/77895

Actions #3

Updated by Gerrit Code Review almost 2 years ago

Patch set 3 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/77895

Actions #4

Updated by Gerrit Code Review almost 2 years ago

Patch set 4 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/77895

Actions #5

Updated by Markus Hofmann almost 2 years ago

  • Assignee set to Markus Hofmann
Actions #6

Updated by Gerrit Code Review over 1 year ago

Patch set 5 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/77895

Actions #7

Updated by Gerrit Code Review over 1 year ago

Patch set 6 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/77895

Actions #8

Updated by Gerrit Code Review over 1 year ago

Patch set 7 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/77895

Actions #9

Updated by Gerrit Code Review over 1 year ago

Patch set 8 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/77895

Actions #10

Updated by Gerrit Code Review over 1 year ago

Patch set 9 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/77895

Actions #11

Updated by Gerrit Code Review over 1 year ago

Patch set 10 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/77895

Actions #12

Updated by Gerrit Code Review over 1 year ago

Patch set 1 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/77945

Actions #13

Updated by Markus Hofmann over 1 year ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #14

Updated by Benni Mack over 1 year ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF