Issue Bug Closed

#80944Inline records are duplicated upon saving the master record

Xavier Perseguers 04/21/17, 15:37 updated 04/29/26, 08:00

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.

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.

History 15

  1. Oliver Hader changed category assigned to Oliver Hader PHP Version 7.0 Complexity medium <span data-processor="relativetime" data-value="2017-04-21T15:55:20+00:00" > 04/21/17, 15:55 </span>

  2. Oliver Hader commented and changed status New Needs Feedback <span data-processor="relativetime" data-value="2017-04-23T21:14:16+00:00" > 04/23/17, 21:14 </span>

    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
  3. Thomas Kühnel commented <span data-processor="relativetime" data-value="2019-03-22T11:01:54+00:00" > 03/22/19, 11:01 </span>

    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
  4. Benni Mack commented and changed status New Needs Feedback <span data-processor="relativetime" data-value="2026-01-17T18:41:23+00:00" > 01/17/26, 18:41 </span>

    Looking at the code we have solved this – I cannot reproduce this properly in v14, and we do have tests for this:

    - localizePageWithLocalizationExclude
    - localizePageTwiceWithLocalizationExclude
    - localizePageAndAddHotelChildWithLocalizationExclude

    maybe you have an extension at hand so I could reproduce this?

  5. Riccardo De Contardi commented and changed status Needs Feedback Closed <span data-processor="relativetime" data-value="2026-04-29T08:00:11+00:00" > 04/29/26, 08:00 </span>

    I close this issue after long time without feedback (> 90 days);

    if you think that this is the wrong decision or experience the issue again, please reopen it or open a new issue with a reference to this one.

    Thank you.