Bug #76054
openEpic #86307: Extbase allows to fetch deleted/hidden records (respects ignoreEnableFields)
Extbase ignores parent record's enableFields when using ContentFallback
0%
Description
Environment
1. T3 7.6.6
2. Language setting as below
config { ## Language Settings linkVars = L(1-2) sys_language_uid = 0 sys_language_overlay = 1 language = de locale_all = de_CH.UTF-8 alternate_html_xhtml_language = de htmlTag_langKey = de sys_language_softMergeIfNotBlank = tt_content:image, tt_content:caption } ## Condition to change language settings for English [globalVar = GP:L = 1] config { sys_language_uid = 1 sys_language_mode = content_fallback; 0 language = en locale_all = en_US.UTF-8 alternate_html_xhtml_language = en htmlTag_langKey = en } [end] ## Condition to change language settings for French [globalVar = GP:L = 2] config { sys_language_uid = 2 sys_language_mode = content_fallback; 1,0 language = fr locale_all = fr_FR.UTF-8 alternate_html_xhtml_language = fr htmlTag_langKey = fr } [end]
3. There is small Extbase extension that contains product table that can be localised to another languages (above)
4. In backend, I create a new product record and then translate to EN and FR
Issue
When I hide (hidden=1) parent product record, the translated product records are still returned by repository (findAll)
Assumption
I understand that records which have language in EN or FR can be displayed as well when it is real orphan or independently created.
But this case is a bug and not that feature because the parent is still alive (only flagged as hidden) and the translated records keep storing the parentUid in its l10_parent as well.
If my assumption is agreed,, the fix
in typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbBackend.php
in function "doLanguageAndWorkspaceOverlay"
in block
$overlaidRows = array(); foreach ($rows as $row) { // If current row is a translation select its parent if (isset($tableName) && isset($GLOBALS['TCA'][$tableName]) && isset($GLOBALS['TCA'][$tableName]['ctrl']['languageField']) && isset($GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerField']) && !isset($GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerTable']) ) { if (isset($row[$GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerField']]) && $row[$GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerField']] > 0 ) { $row = $this->databaseHandle->exec_SELECTgetSingleRow( $tableName . '.*', $tableName, $tableName . '.uid=' . (int)$row[$GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerField']] . /* BEFORE PATCHING */ //' AND ' . $tableName . '.' . $GLOBALS['TCA'][$tableName]['ctrl']['languageField'] . '=0' /* AFTER PATCHING */ ' AND ' . $tableName . '.' . $GLOBALS['TCA'][$tableName]['ctrl']['languageField'] . '=0' . $pageRepository->enableFields($tableName) ); } } $pageRepository->versionOL($tableName, $row, true); if ($tableName == 'pages') { $row = $pageRepository->getPageOverlay($row, $querySettings->getLanguageUid()); } elseif (isset($GLOBALS['TCA'][$tableName]['ctrl']['languageField']) && $GLOBALS['TCA'][$tableName]['ctrl']['languageField'] !== '' && !isset($GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerTable']) ) { if (in_array($row[$GLOBALS['TCA'][$tableName]['ctrl']['languageField']], array(-1, 0))) { $overlayMode = $querySettings->getLanguageMode() === 'strict' ? 'hideNonTranslated' : ''; $row = $pageRepository->getRecordOverlay($tableName, $row, $querySettings->getLanguageUid(), $overlayMode); } } if ($row !== null && is_array($row)) { $overlaidRows[] = $row; } }
Also good to have a look at file web/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbQueryParser.php
at function "getSysLanguageStatement" and when $mode is not 'strict'
Updated by Tymoteusz Motylewski about 7 years ago
- Category changed from Extbase to Extbase + l10n
Updated by Tymoteusz Motylewski about 6 years ago
- Related to Bug #83179: getSysLanguageStatement builder does not respect enable fields added