Project

General

Profile

Actions

Bug #76054

open

Epic #86307: Extbase allows to fetch deleted/hidden records (respects ignoreEnableFields)

Extbase ignores parent record's enableFields when using ContentFallback

Added by Sengchheang Chhun almost 8 years ago. Updated over 5 years ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Extbase + l10n
Start date:
2016-05-05
Due date:
% Done:

0%

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

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'


Related issues 1 (1 open0 closed)

Related to TYPO3 Core - Bug #83179: getSysLanguageStatement builder does not respect enable fieldsNew2017-11-30

Actions
Actions #1

Updated by Tymoteusz Motylewski over 6 years ago

  • Category changed from Extbase to Extbase + l10n
Actions #2

Updated by Tymoteusz Motylewski over 5 years ago

  • Related to Bug #83179: getSysLanguageStatement builder does not respect enable fields added
Actions #3

Updated by Tymoteusz Motylewski over 5 years ago

  • Parent task set to #86307
Actions

Also available in: Atom PDF