Project

General

Profile

Actions

Bug #61543

closed

Language Fallback fails when displaying records, which have translation for other languages but not the current language

Added by Andre Rinas over 9 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Must have
Assignee:
Category:
-
Target version:
-
Start date:
2014-09-11
Due date:
% Done:

0%

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

Description

We are building on an extension with extbase and found something special:

If you have for example 3 Languages (en = 0, de =1, fr = 2) and

you create 4 Records in english and nothing else
- > all 4 records are showing up in all 3 languages in english

If you create translation for records in fr you then:
- > all 4 records showing in english => right
- > all 4 records showing in french => right
- > none record showing in german => wrong!

After some debugging we found out that addSysLanguageStatement in file:
/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbQueryParser.php

makes the error.

if ($mode === 'strict') {
    $additionalWhereClause = $tableName . '.' . $GLOBALS['TCA'][$tableName]['ctrl']['languageField'] . '=-1' .
        ' OR (' . $tableName . '.' . $GLOBALS['TCA'][$tableName]['ctrl']['languageField'] . ' = ' . (int)$querySettings->getLanguageUid() .
        ' AND ' . $tableName . '.' . $GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerField'] . '=0' .
        ') OR (' . $tableName . '.' . $GLOBALS['TCA'][$tableName]['ctrl']['languageField'] . '=0' .
        ' AND ' . $tableName . '.uid IN (SELECT ' . $tableName . '.' . $GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerField'] .
        ' FROM ' . $tableName .
        ' WHERE ' . $tableName . '.' . $GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerField'] . '>0' .
        ' AND ' . $tableName . '.' . $GLOBALS['TCA'][$tableName]['ctrl']['languageField'] . '=' . (int)$querySettings->getLanguageUid() ;
} else {
    $additionalWhereClause .= ' OR (' . $tableName . '.' . $GLOBALS['TCA'][$tableName]['ctrl']['languageField'] . '=0' .
        ' AND ' . $tableName . '.uid NOT IN (SELECT ' . $tableName . '.' . $GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerField'] .
        ' FROM ' . $tableName .
        ' WHERE ' . $tableName . '.' . $GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerField'] . '>0' .    

' AND ' . $tableName . '.' . $GLOBALS['TCA'][$tableName]['ctrl']['languageField'] . '>0';

 }

The marked line is excluding uid's for fallback, if any translation for the record is found, but it has to remove only records that are in the current language.
The line should be deleted or extended.

So if you are in german (sys_language_uid = 1 in my example) it should be:
' AND ' . $tableName . '.' . $GLOBALS['TCA'][$tableName]['ctrl']['languageField'] . '=1';


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #62155: IRRE at localized records not working properly with Extbase/Fluid Rejected2014-10-10

Actions
Actions

Also available in: Atom PDF