Project

General

Profile

Actions

Bug #83667

closed

Language menu is displayed for new (unsaved) records

Added by Surena Golijani about 6 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
FormEngine aka TCEforms
Target version:
-
Start date:
2018-01-24
Due date:
% Done:

0%

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

Description

Language menu is displayed for new (unsaved) records, showing faulty select options

The bug is caused by the EditDocumentController not checking if any data is loaded for the current record, which is not the case if a new and unsaved record is edited.
The EditDocumentController continues to build the language menu, although the context in which it is build is faulty because of the missing data.

How to reproduce the bug with tt_news records as an example (the Bug is caused by the EditDocumentController independent from the type of the record being edited):
  • create a tt_news record in a non-default language (field sys_language_uid>0) without any original record set (field l18n_parent=0)
  • create a new tt_news record: the language menu is shown with the single entry of the language of the above record
Bugfix:
  • add condition to avoid building the language menu if no data is loaded for the current record
  • typo3/sysext/backend/Classes/Controller/EditDocumentController.php languageSwitch():
                if (is_array($langRows) && count($langRows) > 1) {
                    $rowsByLang = [];
                    $fetchFields = 'uid,' . $languageField . ',' . $transOrigPointerField;
                    // Get record in current language
                    $rowCurrent = BackendUtility::getLiveVersionOfRecord($table, $uid, $fetchFields);
                    if (!is_array($rowCurrent)) {
                        $rowCurrent = BackendUtility::getRecord($table, $uid, $fetchFields);
                    }
    
                    /**
                     * BUGFIX START
                     */
                    if (is_array($rowCurrent)) {
                    /**
                     * BUGFIX END
                     */
    
                        $currentLanguage = (int)$rowCurrent[$languageField];
                        // Disabled for records with [all] language!
                        if ($currentLanguage > -1) {
    

Affected TYPO3 versions: at least 7 & 8

Actions #1

Updated by Susanne Moog about 6 years ago

  • Category set to FormEngine aka TCEforms
Actions #2

Updated by Susanne Moog about 4 years ago

  • Status changed from New to Closed

This is fixed meanwhile due to the introduction of the new site / language handling and the rewritten handling of the language drop downs.

Actions

Also available in: Atom PDF