Bug #88153
closedDeleted translations still show up in language selector
100%
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