Bug #57063

Parent language is not applied to new child records

Added by David Greiner over 5 years ago. Updated 10 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
FormEngine aka TCEforms
Target version:
-
Start date:
2014-03-19
Due date:
% Done:

100%

TYPO3 Version:
6.1
PHP Version:
5.3
Tags:
Complexity:
medium
Is Regression:
No
Sprint Focus:

Description

Hi!

When creating a element in another language than the default language and adding a child element via IRRE, i am expecting that the child element gets the same language as the parent element.

For instance a news element from tx_news:

  1. Create new news element and choose a language which is not defined as default
  2. save
  3. add a media element via irre
  4. now you have to select the language in the media element again

This behaviour is not very usable for editors.

InlineElement.patch View (915 Bytes) David Greiner, 2014-04-09 11:55

InlineElement_2nd.patch View (973 Bytes) David Greiner, 2014-04-09 13:52


Related issues

Related to TYPO3 Core - Bug #48883: Wrong sys_language_uid in sys_file_reference Closed 2013-06-05
Related to TYPO3 Core - Bug #40656: t3lib_TCEforms_inline->createNewRecord doesn't create localized records Closed 2012-09-05
Related to TYPO3 Core - Feature #60026: Set explicitly 'readOnly' sys_language_uid of child to value, taken from parent record New 2014-07-01
Duplicated by TYPO3 Core - Bug #21964: New child records created from a translated record have default language Closed 2010-01-15

Associated revisions

Revision cf9ca274 (diff)
Added by David Greiner about 5 years ago

[BUGFIX] Parent language is not applied to new child records

If localizing a parent-child structure, usually the language
of the parent element shall be applied to related child records
as well as new child records.

Due to a missing array segment, the accordant section in the
the InlineElement source code never was processed.

Resolves: #57063
Releases: 6.2, 6.1
Change-Id: I7e563044f9889538f9b8171f71f7685722db8266
Reviewed-on: https://review.typo3.org/30448
Reviewed-by: Markus Klein
Reviewed-by: David Greiner
Reviewed-by: Wouter Wolters
Reviewed-by: Oliver Hader
Tested-by: Oliver Hader

Revision 3e6e8ec8 (diff)
Added by David Greiner about 5 years ago

[BUGFIX] Parent language is not applied to new child records

If localizing a parent-child structure, usually the language
of the parent element shall be applied to related child records
as well as new child records.

Due to a missing array segment, the accordant section in the
the InlineElement source code never was processed.

Resolves: #57063
Releases: 6.2, 6.1
Change-Id: I7e563044f9889538f9b8171f71f7685722db8266
Reviewed-on: https://review.typo3.org/30472
Reviewed-by: Oliver Hader
Tested-by: Oliver Hader

History

#1 Updated by David Greiner over 5 years ago

I think there is a bug in /typo3/sysext/backend/Classes/Form/Element/InlineElement.php

Defining

'behaviour' => array(
'localizationMode' => 'select',
...
),

should be neccessary since it is described in http://docs.typo3.org/typo3cms/TCAReference/Reference/Columns/Inline/Index.html#columns-inline-properties-behaviour

Adding this to the TCA configuration does not take effect cause of InlineElement.php:1223 checks for $config['localizationMode'] and not for $config['behaviour']['localizationMode'].

This is what the attached patch updates.

The patch is for the current master branch (6.2) in https://git.typo3.org/Packages/TYPO3.CMS.git

#2 Updated by David Greiner over 5 years ago

Second patch is better.

#3 Updated by Oliver Hader about 5 years ago

  • Status changed from New to Accepted
  • Complexity set to medium

I'll have a look - thx for the patch!
Besides that, I could reproduce the misbehavior.

#4 Updated by Oliver Hader about 5 years ago

  • PHP Version set to 5.3

#5 Updated by Oliver Hader about 5 years ago

  • Subject changed from IRRE: Use localization of parent element to Parent language is not applied to child records

#6 Updated by Oliver Hader about 5 years ago

  • Subject changed from Parent language is not applied to child records to Parent language is not applied to new child records

#7 Updated by Gerrit Code Review about 5 years ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/30448

#8 Updated by Oliver Hader about 5 years ago

David, I modified your patch a little bit, however it was the correct place and correct bug analysis! Good catch & thanks!

#9 Updated by David Greiner about 5 years ago

Great. Thx for that :)

#10 Updated by Gerrit Code Review about 5 years ago

Patch set 1 for branch TYPO3_6-1 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/30472

#11 Updated by Teamgeist Medien about 5 years ago

Just wasted a half day with handling the complications without this function working. Thanks alot!

#12 Updated by David Greiner about 5 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#13 Updated by Markus Opahle over 3 years ago

Looks like this bug reappears in 7.6 LTS.
The fix from 3e6e8ec89c00b04485a3c6050e0cfdd9548a213e is commented out in TYPO3\CMS\Backend\Controller\FormInlineAjaxController on line 139:

        // Set language of new child record to the language of the parent record:
        // @todo: To my understanding, the below case can't happen: With localizationMode select, lang overlays
        // @todo: of children are only created with the "synchronize" button that will trigger a different ajax action.
        // @todo: The edge case of new page overlay together with localized media field, this code won't kick in either.
        /**
        if ($parent['localizationMode'] === 'select' && MathUtility::canBeInterpretedAsInteger($parent['uid'])) {
            $parentRecord = $inlineRelatedRecordResolver->getRecord($parent['table'], $parent['uid']);
            $parentLanguageField = $GLOBALS['TCA'][$parent['table']]['ctrl']['languageField'];
            $childLanguageField = $GLOBALS['TCA'][$child['table']]['ctrl']['languageField'];
            if ($parentRecord[$parentLanguageField] > 0) {
                $record[$childLanguageField] = $parentRecord[$parentLanguageField];
            }
        }
         */

#14 Updated by Tymoteusz Motylewski over 2 years ago

Markus, is it still an issue with current v7 or 8 branch? If yes, plase open a new ticket with steps to reproduce the issue? I tried to reproduce but I couldn't.

#15 Updated by Benni Mack 10 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF