Bug #80944

Inline records are duplicated upon saving the master record

Added by Xavier Perseguers over 2 years ago. Updated 6 months ago.

Status:
Needs Feedback
Priority:
Should have
Assignee:
Category:
Localization
Target version:
-
Start date:
2017-03-06
Due date:
% Done:

0%

TYPO3 Version:
8
PHP Version:
7.0
Tags:
Complexity:
hard
Is Regression:
Sprint Focus:

Description

Context:

  • Locations records (localized)
    • Having Offices are inline relation, may be (externally) localized as well

TCA:

        'offices' => [
            'exclude' => 1,
            'l10n_mode' => 'exclude',
            'label' => 'Offices',
            'config' => [
                'type' => 'inline',
                'foreign_table' => 'tx_myext_domain_model_office',
                'foreign_field' => 'location',
                'foreign_label' => 'name',
                'foreign_sortby' => 'sorting',
                'maxitems' => 20,
                'appearance' => [
                    'collapseAll' => 1,
                    'expandSingle' => 1,
                    'newRecordLinkAddTitle' => 1,
                    'newRecordLinkTitle' => 'New Office',
                ],
            ],
        ],

Since commit e7217da45d1528101aaa2577940a489f45b3029e (#80141), following problem happens:

  • I edit a Location having 2 offices, one of them being "disabled"/"hidden"
  • Doing nothing else than showing the edit form, not expanding either the Offices records
  • Saving
  • Upon form reloading:
    • Disabled Office is still there
    • Visible Office has been duplicated 8 times

Sample extension and data has been shared with Olly for further investigation.


Related issues

Related to TYPO3 Core - Bug #80311: IRRE shows default + translated records Closed 2017-03-16
Related to TYPO3 Core - Feature #79658: Introduce allowLanguageSynchronization Closed 2017-02-07
Related to TYPO3 Core - Bug #87640: Keep language reference for associated l10n_mode=exclude children Closed 2019-02-04
Follows TYPO3 Core - Bug #80141: Add allowLanguageSynchronization chain resolving Closed 2017-03-04

History

#1 Updated by Xavier Perseguers over 2 years ago

  • Due date set to 2017-03-06
  • Start date changed from 2017-04-21 to 2017-03-06
  • Follows Bug #80141: Add allowLanguageSynchronization chain resolving added

#2 Updated by Oliver Hader over 2 years ago

  • Category set to Localization
  • Assignee set to Oliver Hader
  • PHP Version set to 7.0
  • Complexity set to medium

#3 Updated by Oliver Hader over 2 years ago

  • Status changed from New to Needs Feedback

The basic challenge with the extension I received can be expressed as a "It's your turn" dilemma, when nested entities additionally point to each other with misleading semantic.

Written in an abstract way, we have the following TCA:

parent
  columns
    children
      l10n_mode=exclude
      config
        type=inline
        foreign_table=child
        foreign_field=parentid
child
  columns
    parentid
      l10n_mode=exclude
      config
        type=select
        foreign_table=parent

Since the following behavior has been integrated into TYPO3 8.6, l10n_mode "exclude" and "mergeIfNotBlank" are handled differently and the values of the ancestor language source (e.g. "default language") are copied(!) to according translations. Find further details of that change here: https://docs.typo3.org/typo3cms/extensions/core/8-dev/Changelog/8.6/Feature-51291-SynchronizedFieldValuesInLocalizedRecords.html

Lets assume we have the following entities and record ids:
  • parent:1 - default language
    • child:11 - default language
      • child:11.parentid is 1
    • child:12 - default language
      • child:12.parentid is 1
  • parent:2 - translation of parent:1
Now, let's have a look on what happens, when the default language version of the parent entity is modified:
  • all children of parent:1 are copied/synchronized to parent:2 by creating localizations if they don't exist yet
    • localized parent:11 to parent:21
    • localized parent:12 to parent:22
  • the field values of child.parentid of the default language are copied to the their dependent translation records
    • child:11.parentId is copied to child:21.parentid, value is 1
    • child:12.parentId is copied to child:22.parentid, value is 1
    • now both translated children point back to the parent record of the default language - that's the mentioned misbehavior
How to solve this:
  • reconsider all l10n_mode=exclude and l10n_mode=mergeIfNotBlank (later will be migrated automatically to allowLanguageSynchronization=true
  • replace l10n_mode=exclude settings from child references, used in back-selectors to ancestor by displayCond - these are the child.parentid fields from the example above
child
  columns
    parentid
      displayCond=FIELD:sys_language_uid:<=:0
      config
        type=select
        foreign_table=parent
There was a similiar issue in powermail when upgrading to TYPO3 CMS 8, see the commit and initial pull-request for details: The only thing the Core could do here would be:
  • walk down the path of possible nested child references
  • determine back-pointers that would be overridden
  • throw an exception with more explanation
  • this mechanism would have to consider all possible relations of the whole system

#4 Updated by Oliver Hader over 2 years ago

  • Complexity changed from medium to hard

#5 Updated by Oliver Hader over 2 years ago

  • Related to Bug #80311: IRRE shows default + translated records added

#6 Updated by Oliver Hader over 2 years ago

  • Related to Feature #79658: Introduce allowLanguageSynchronization added

#7 Updated by Oliver Hader over 2 years ago

  • Due date deleted (2017-03-06)

#9 Updated by Oliver Hader 7 months ago

  • Related to Bug #87640: Keep language reference for associated l10n_mode=exclude children added

#10 Updated by Thomas Scholze 6 months ago

I'm able to reproduce this behavior if the parent field is 'exclude' => true and the editor has no access to this field. The child is configured this way:

child
  columns
    parentid
      config
        type=passthrough

Also available in: Atom PDF