Project

General

Profile

Actions

Bug #77738

closed

Standard language value not saved for language selection field

Added by Florian Baumann about 8 years ago. Updated about 8 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Backend User Interface
Target version:
Start date:
2016-09-01
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
7
PHP Version:
5.6
Tags:
language, backend
Complexity:
medium
Is Regression:
Yes
Sprint Focus:

Description

After upgrading our instances to 7.6.10, we discovered that the language value for the standard language (sys_language_uid = 0) is not saved in the DB.

We built a custom language selection field that is rendered as checkboxes in BE with the following TCA:

 'allowed_languages' => array(
                'label' => 'LLL:EXT:sfpdownloadcenter/Resources/Private/Language/locallang_db.xlf:tca.field.allowed_languages',
                'l10n_mode' => 'exclude',
                'config' => array(
                        'type' => 'select',
                        'special' => 'languages',
                        'maxitems' => 1000,
                        'renderMode' => 'checkbox'
                )
  ),

All languages != sys_language_uid = 0 are saved properly in the DB.

See attached screenshots for further explanation.

The field is added to the table sys_file_metadata and defined as follows:

allowed_languages varchar(255) DEFAULT '' NOT NULL

Actually it should save all the checked boxes but it just skips the one for the standard language.


Files

sys_language all.jpg (61 KB) sys_language all.jpg Florian Baumann, 2016-09-01 10:35
sys_language after save.jpg (61.8 KB) sys_language after save.jpg Florian Baumann, 2016-09-01 10:35

Related issues 1 (0 open1 closed)

Is duplicate of TYPO3 Core - Bug #75998: be user and group "limit to language" property not saved when choosing default onlyClosed2016-05-01

Actions
Actions #1

Updated by Dmitry Dulepov about 8 years ago

  • Is Regression changed from No to Yes

Hunk 1 here is responsible for the trouble. It verifies that submitted languages exist in sys_language table. Obviously value with id 0 is not there. So it is not allowed.

This is a regression.

Actions #2

Updated by Wouter Wolters about 8 years ago

  • Status changed from New to Closed

This one is solved already with https://forge.typo3.org/issues/75998 and will be part of the next release.
Thanks for reporting it though.

Actions #3

Updated by Dmitry Dulepov about 8 years ago

Just a side note. The fix there is not very clean... Relation handler should not know about such things because it should focus on true relations. The fix should be in the DataHandler instead:

--- typo3/sysext/core/Classes/DataHandling/DataHandler.php  2016-09-01 15:42:51.079168920 +0200
+++ typo3/sysext/core/Classes/DataHandling/DataHandler.php  2016-09-01 16:44:38.000000000 +0200
@@ -2130,7 +2130,14 @@
                 );
                 $unsetResult = true;
             } else {
+                $reInsertZeroLanguage = false;
+                if (isset($tcaFieldConf['special']) && $tcaFieldConf['special'] === 'languages' && in_array('0', $valueArray)) {
+                    $reInsertZeroLanguage = true;
+                }
                 $valueArray = $this->checkValue_group_select_processDBdata($valueArray, $tcaFieldConf, $id, $status, 'select', $table, $field);
+                if ($reInsertZeroLanguage) {
+                    array_unshift($valueArray, '0');
+                }
             }
         }
         if (!$unsetResult) {

But since it is already done, let it be...

Actions

Also available in: Atom PDF