Project

General

Profile

Actions

Bug #88153

closed

Deleted translations still show up in language selector

Added by Robert Vock over 5 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Workspaces
Target version:
-
Start date:
2019-04-15
Due date:
% Done:

100%

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

Description

When you delete a translation of a content element in a workspace, that translation still appears in the language selector when editing the original element or another translation which has not been deleted. This is because the language selector does not remove elements which have a DELETE placeholder in the current workspace.

Steps to reproduce:
1. Create a content element with a translation
2. Switch to workspace and delete the translation
3. Edit the original element in the workspace

The language selector still shows the translation.

This bug appears in current master, TYPO3 9 and 8. I didn't test in TYPO3 7, but would suspect it's affected as well.

Buggy code location:
EditDocumentController.php:L2034

I am not sure what the "correct" way to fix this is. In some parts of the Core Backend::getWorkspaceVersionOfRecord is used. In other parts BackendUtility::workspaceOL is used:
LocalizationController.php:L146
TcaInline.php:L384

If the approach of TcaInline should be used, the correct code would look like this:

$backendUser = $this->getBackendUser();
while ($row = $result->fetch()) {
    if ($backendUser->workspace !== 0 && BackendUtility::isTableWorkspaceEnabled($table)) {
        $workspaceVersion = BackendUtility::getWorkspaceVersionOfRecord($backendUser->workspace, $table, $row['uid'], 'uid,t3ver_state');
        if (!empty($workspaceVersion)) {
            $versionState = VersionState::cast($workspaceVersion['t3ver_state']);
            if ($versionState->equals(VersionState::DELETE_PLACEHOLDER)) {
                continue;
            }
        }
    }
    $rowsByLang[$row[$languageField]] = $row;
}

But: This only fixes the selector. When this fix is applied, the selector looks like Correct.png. But when you then try to create a new translation, you get the following error:

1: Localization failed: there already are localizations (2) for language 1 of the "tt_content" record 1!

This is another bug, because creating a translation also does not check for deleted elements in the workspace:
BackendUtility.php:L304
BackendUtility::getRecordLocalization should probably also apply the workspaceOverlay.


Files

Deleted-Element-in-workspace.png (29.8 KB) Deleted-Element-in-workspace.png Robert Vock, 2019-04-15 15:46
Correct.png (31.7 KB) Correct.png Robert Vock, 2019-04-15 15:53
cattura.png (247 KB) cattura.png Riccardo De Contardi, 2020-07-25 13:13
cattura2.png (39.8 KB) cattura2.png Riccardo De Contardi, 2020-07-25 13:15
Actions

Also available in: Atom PDF