Bug #89131

Records that are only available in specific language (no default parent) are not considered using consistentTranslationOverlayHandling

Added by Matthias Meusburger 2 months ago.

Status:
New
Priority:
Should have
Category:
Extbase + l10n
Target version:
-
Start date:
2019-09-10
Due date:
% Done:

0%

TYPO3 Version:
9
PHP Version:
7.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

There's no differentiation between LanguageAspect::OVERLAYS_ON and LanguageAspect::OVERLAYS_ON_WITH_FLOATING in Extbase. 'hideNonTranslated' corresponds to both (see LanguageAspect::getLegacyOverlayType()).

Therefore, I think records that are only available in a specific language should also be considered (as it says for LanguageAspect::OVERLAYS_ON_WITH_FLOATING).
But I'm not sure if it should be done only for language mode "hideNonTranslated" or also for language mode true (LanguageAspect::OVERLAYS_MIXED).

Suggestion:

If it can be done for language mode true and hideNonTranslated:

sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbQueryParser.php

925  925        // translated records where a default translation exists
926  926        $andConditions[] = $this->queryBuilder->expr()->andX(
927  927            $this->queryBuilder->expr()->eq($tableAlias . '.' . $languageField, (int)$querySettings->getLanguageUid()),
928       -         $this->queryBuilder->expr()->in(
929       -             $tableAlias . '.' . $transOrigPointerField,
930       -             $defaultLanguageRecordsSubSelect->getSQL()
     928  +         $this->queryBuilder->expr()->orX(
     929  +             $this->queryBuilder->expr()->in($tableAlias . '.' . $transOrigPointerField, 0),
     930  +             $this->queryBuilder->expr()->in(
     931  +                 $tableAlias . '.' . $transOrigPointerField,
     932  +                 $defaultLanguageRecordsSubSelect->getSQL()
     933  +             )
931  934            )
932  935        );
933  936        if ($mode !== 'hideNonTranslated') {

If it should be done only for language mode hideNonTranslated:

sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbQueryParser.php

918                         $defaultLanguageRecordsSubSelect->expr()->eq($defLangTableAlias . '.' . $languageField, 0)
919                     )
920                 );
     921  +     $transOrigPointerCondition = $this->queryBuilder->expr()->in(
     922  +         $tableAlias . '.' . $transOrigPointerField,
     923  +         $defaultLanguageRecordsSubSelect->getSQL()
     924  +     );
     925  +     if ($mode === 'hideNonTranslated') {
     926  +         $transOrigPointerCondition = $this->queryBuilder->expr()->orX(
     927  +             $this->queryBuilder->expr()->in($tableAlias . '.' . $transOrigPointerField, 0),
     928  +             $transOrigPointerCondition
     929  +         );
     930  +     }
921  931
922  932        $andConditions = [];
923  933        // records in language 'all'
924  934        $andConditions[] = $this->queryBuilder->expr()->eq($tableAlias . '.' . $languageField, -1);
925  935        // translated records where a default translation exists
926  936        $andConditions[] = $this->queryBuilder->expr()->andX(
927  937            $this->queryBuilder->expr()->eq($tableAlias . '.' . $languageField, (int)$querySettings->getLanguageUid()),
928       -         $this->queryBuilder->expr()->in(
929       -             $tableAlias . '.' . $transOrigPointerField,
930       -             $defaultLanguageRecordsSubSelect->getSQL()
931       -         )
     938  +         $transOrigPointerCondition
932  939        );
933  940        if ($mode !== 'hideNonTranslated') {

Example to illustrate the problem:

A German news with e.g. sys_language_uid 1 and without parent record (German only) is currently not output on the German page with consistentTranslationOverlayHandling and fallbackType: strict. With the above fix it will be included.

Also available in: Atom PDF