#68040Inline localize and/or synchronize does not respect sorting
Description
Working with IRRE in multilingual projects you often have the situation, that elements have been translated already but they need to get additional content, which has been added to the default language records.
For this purpose there are two buttons in the editing form of the IRRE parent to either “localize” and/or “synchronize” the elements. While the first will just add new elements, the latter will even remove elements that have been deleted in the original language.
These actions are working quite well with a small exception: The sorting of the default language children is not respected, since new translated elements are just added after existing elements, even when they actually have been added between existing elements in the original language.
This leads to completely broken structures especially with deeper nesting levels of extensions like i.e. Gridelements. We noticed that while preparing the Localization Manager for Gridelements support and first thought it was a bug in either l10nmgr or GE. But while testing the manual localize/synchronize functionality, we found the same buggy behaviour.
IMHO the sorting must be synchronized from the default language after adding/removing elements in the target language.
Reviews 2
Related issues 6
- Bug #43158Sorting of parent records also moves inline childs
- Bug #50310DataHandler fails to correctly re-sort (content) elements after moving one to top
- Bug #75400Related child elements don't get correct sys_language_uid during localization of parent record
- Bug #83079wrong sorting of content elements when translating using non-default-language CEs as source
- Bug #83469Translation of translations break sorting in tt_content
- Bug #84228Output error reasons if Build/Scripts/checkIntegrityCsvFixtures.php fails
Files 1
History 1947
Show 1422 earlier messages
-
Jo Hasenau commented and changed status
NewAccepted Complexityeasymedium <span data-processor="relativetime" data-value="2015-07-17T22:05:21+00:00" > 07/17/15, 22:05 </span> -
Jo Hasenau commented <span data-processor="relativetime" data-value="2015-07-17T22:13:07+00:00" > 07/17/15, 22:13 </span>
For the inline subtype “list” it works, since the CSV value is written into the field.
For “field” and “mm” there is no sorting at all. -
Oliver Hader commented and changed attached 68040_current.png <span data-processor="relativetime" data-value="2015-10-19T20:55:48+00:00" > 10/19/15, 20:55 </span>
Is that the behavior your referring to (see screenshot)?
-
Mathias Schreiber changed target version <span data-processor="relativetime" data-value="2015-11-12T17:07:24+00:00" > 11/12/15, 17:07 </span>
-
Jo Hasenau commented <span data-processor="relativetime" data-value="2016-01-14T11:18:23+00:00" > 01/14/16, 11:18 </span>
Exactly this is the problem
-
Jo Hasenau changed Duplicated by #82109 <span data-processor="relativetime" data-value="2017-08-16T12:10:01+00:00" > 08/16/17, 12:10 </span>
-
Andreas Wolf commented <span data-processor="relativetime" data-value="2017-08-18T19:16:14+00:00" > 08/18/17, 19:16 </span>
I investigated this and found the culprit: It’s
RelationHandler, notDataHandler. The sorting is indeed correct directly after translation, or at least it was in my test case—I cannot tell for sure for every use case.The sorting is then messed up by
RelationHandler::writeForeignField(), which is called byDataHandler::inlineLocalizeSynchronize(). AFAICS, the basic problem here is that the order of elements is already wrong in the data supplied by FormEngine, and this incorrect order is then apparently carried on to RelationHandler (while DataHandler at least in some cases does the sorting correctly, but that might also be by accident here).I fear this is not easily fixable without potentially breaking other things. The best fix would probably be to get the order right in FormEngine already, but I did not manage to easily fix this (in
TcaInline::resolveRelatedRecords()). An additional problem here (in the context of connected mode) is that currently the ordering would be taken from the localized record, except for the non-localized records, and this did not work out in my tests. -
Andreas Wolf commented <span data-processor="relativetime" data-value="2017-08-18T21:58:16+00:00" > 08/18/17, 21:58 </span>
Andreas Wolf wrote:
> The sorting is then messed up byRelationHandler::writeForeignField(), which is called byDataHandler::inlineLocalizeSynchronize().Further research and tests showed that this is incorrect.
writeForeignField()is called byDataHandler::remapListedDBRecords_procInline()when processing the translated Gridelements container.The value processed in
remapListedDBRecords_procInlinecomes fromDataHandler->registerDBList[tt_content][<container UID>]. It looks like this: “4,5,,8,”, with the last ID being the new element. That value was in turn fetched from$dbAnalysisCurrent, aRelationHandlerinstance used inDataHandler::inlineLocalizeSynchronize() -
Gerrit Code Review pushed patch set 1 for master to change 53739 status
AcceptedUnder Review <span data-processor="relativetime" data-value="2017-08-19T10:13:08+00:00" > 08/19/17, 10:13 </span> -
Gerrit Code Review pushed patch set 2 for master to change 53739 <span data-processor="relativetime" data-value="2017-08-19T10:23:50+00:00" > 08/19/17, 10:23 </span>
-
Gerrit Code Review pushed patch set 3 for master to change 53739 <span data-processor="relativetime" data-value="2017-11-30T11:14:30+00:00" > 11/30/17, 11:14 </span>
-
Gerrit Code Review pushed patch set 4 for master to change 53739 <span data-processor="relativetime" data-value="2017-11-30T11:29:51+00:00" > 11/30/17, 11:29 </span>
-
Gerrit Code Review pushed patch set 5 for master to change 53739 <span data-processor="relativetime" data-value="2017-11-30T11:33:42+00:00" > 11/30/17, 11:33 </span>
-
Markus Klein changed removed the assignee target version <span data-processor="relativetime" data-value="2018-03-09T23:25:06+00:00" > 03/09/18, 23:25 </span>
-
Gerrit Code Review pushed patch set 6 for master to change 53739 <span data-processor="relativetime" data-value="2018-03-12T23:40:16+00:00" > 03/12/18, 23:40 </span>
-
Gerrit Code Review pushed patch set 7 for master to change 53739 <span data-processor="relativetime" data-value="2018-03-13T00:07:06+00:00" > 03/13/18, 00:07 </span>
-
Markus Klein changed due date start date Follows #84228 <span data-processor="relativetime" data-value="2018-03-13T00:42:47+00:00" > 03/13/18, 00:42 </span>
-
Oliver Hader changed target version <span data-processor="relativetime" data-value="2018-03-13T10:28:58+00:00" > 03/13/18, 10:28 </span>
-
Gerrit Code Review pushed patch set 8 for master to change 53739 <span data-processor="relativetime" data-value="2018-03-13T11:30:19+00:00" > 03/13/18, 11:30 </span>
-
Susanne Moog changed Related to #83079 <span data-processor="relativetime" data-value="2018-03-15T21:24:59+00:00" > 03/15/18, 21:24 </span>
-
Sybille Peters commented <span data-processor="relativetime" data-value="2018-03-31T23:42:57+00:00" > 03/31/18, 23:42 </span>
I’m adding a reproduce scenario. I used bootstrap carousel from bootstrap_package for testing.
- Create an element of type bootstrap carousel.
- Add 2 IRRE elements (“Carousel item”)
- Translate the element with mode “Translate”
- Add another IRRE element in the content element of the original language
- Move the new IRRE element from third to second place
- Edit the translated element, click on “Synchronize with original language”
Expected: Now, in the translated element the 3 IRRE elements should be in the same order as in the original.
Actual result: In the translated element, the new IRRE element is added as last element (incorrect order)
Also, in the latest master an error message is displayed: “1: Localization failed; There already was a localization for this language of the record!”
-
Benni Mack changed target version <span data-processor="relativetime" data-value="2018-06-12T10:24:15+00:00" > 06/12/18, 10:24 </span>
-
Tymoteusz Motylewski changed Related to #83469 <span data-processor="relativetime" data-value="2018-08-09T14:13:55+00:00" > 08/09/18, 14:13 </span>
-
Susanne Moog changed target version <span data-processor="relativetime" data-value="2018-09-06T14:54:57+00:00" > 09/06/18, 14:54 </span>
-
Gerrit Code Review pushed patch set 9 for master to change 53739 <span data-processor="relativetime" data-value="2018-12-14T11:06:45+00:00" > 12/14/18, 11:06 </span>
-
Gerrit Code Review pushed patch set 10 for master to change 53739 <span data-processor="relativetime" data-value="2018-12-20T12:32:51+00:00" > 12/20/18, 12:32 </span>
-
Gerrit Code Review pushed patch set 11 for master to change 53739 <span data-processor="relativetime" data-value="2018-12-20T12:34:42+00:00" > 12/20/18, 12:34 </span>
-
Gerrit Code Review pushed patch set 12 for master to change 53739 <span data-processor="relativetime" data-value="2018-12-20T12:49:28+00:00" > 12/20/18, 12:49 </span>
-
Gerrit Code Review pushed patch set 13 for master to change 53739 <span data-processor="relativetime" data-value="2020-05-25T20:46:28+00:00" > 05/25/20, 20:46 </span>
-
Benni Mack changed Related to #50310 <span data-processor="relativetime" data-value="2020-11-13T08:25:07+00:00" > 11/13/20, 08:25 </span>
-
Gerrit Code Review pushed patch set 14 for master to change 53739 <span data-processor="relativetime" data-value="2021-11-18T10:36:32+00:00" > 11/18/21, 10:36 </span>
-
Gerrit Code Review pushed patch set 15 for main to change 53739 <span data-processor="relativetime" data-value="2021-11-29T14:08:26+00:00" > 11/29/21, 14:08 </span>
-
Gerrit Code Review pushed patch set 16 for main to change 53739 <span data-processor="relativetime" data-value="2021-12-23T09:40:23+00:00" > 12/23/21, 09:40 </span>
-
Gerrit Code Review pushed patch set 17 for main to change 53739 <span data-processor="relativetime" data-value="2023-05-03T09:13:32+00:00" > 05/03/23, 09:13 </span>
-
Gerrit Code Review pushed patch set 18 for main to change 53739 <span data-processor="relativetime" data-value="2023-07-05T19:09:06+00:00" > 07/05/23, 19:09 </span>
-
Gerrit Code Review pushed patch set 19 for main to change 53739 <span data-processor="relativetime" data-value="2023-07-05T19:27:34+00:00" > 07/05/23, 19:27 </span>
-
Gerrit Code Review pushed patch set 20 for main to change 53739 <span data-processor="relativetime" data-value="2023-07-05T19:28:42+00:00" > 07/05/23, 19:28 </span>
-
Gerrit Code Review pushed patch set 21 for main to change 53739 <span data-processor="relativetime" data-value="2023-07-06T14:08:44+00:00" > 07/06/23, 14:08 </span>
-
Gerrit Code Review pushed patch set 22 for main to change 53739 <span data-processor="relativetime" data-value="2023-07-06T15:10:24+00:00" > 07/06/23, 15:10 </span>
-
Gerrit Code Review pushed patch set 23 for main to change 53739 <span data-processor="relativetime" data-value="2024-10-18T14:08:38+00:00" > 10/18/24, 14:08 </span>
-
Gerrit Code Review pushed patch set 24 for main to change 53739 <span data-processor="relativetime" data-value="2025-08-14T06:13:40+00:00" > 08/14/25, 06:13 </span>
-
Gerrit Code Review pushed patch set 25 for main to change 53739 <span data-processor="relativetime" data-value="2026-04-22T06:53:04+00:00" > 04/22/26, 06:53 </span>
-
Gerrit Code Review pushed patch set 26 for main to change 53739 <span data-processor="relativetime" data-value="2026-09-02T06:31:18+00:00" > 09/02/26, 06:31 </span>
-
Gerrit Code Review pushed patch set 27 for main to change 53739 <span data-processor="relativetime" data-value="2026-09-02T17:49:17+00:00" > 09/02/26, 17:49 </span>
-
Gerrit Code Review pushed patch set 1 for 14.3 to change 95648 <span data-processor="relativetime" data-value="2026-09-04T15:37:19+00:00" > 09/04/26, 15:37 </span>
-
Anonymous commented and changed status
Under ReviewResolved done0 %100 % <span data-processor="relativetime" data-value="2026-09-04T15:40:11+00:00" > 09/04/26, 15:40 </span>Applied in changeset commit:6e67f9e4ea6fbe8f29b4f41830a92c5c2ee7c4d8.
-
Benni Mack changed status
ResolvedClosed <span data-processor="relativetime" data-value="2026-09-08T10:03:30+00:00" > 09/08/26, 10:03 </span>
It seems line 4588 of typo3/sysext/core/Classes/DataHandling/DataHandler.php just contains a wrong information about what’s going to happen in the block below.
// Handle, reorder and store relations: if ($inlineSubType == 'list') { $updateFields = array($field => $value); } elseif ($inlineSubType == 'field') { $dbAnalysisCurrent->writeForeignField($config, $id); $updateFields = array($field => $dbAnalysisCurrent->countItems(FALSE)); } elseif ($inlineSubType == 'mm') { $dbAnalysisCurrent->writeMM($config['MM'], $id); $updateFields = array($field => $dbAnalysisCurrent->countItems(FALSE)); } // Update field referencing to child records of localized parent record: if (!empty($updateFields)) { $this->updateDB($table, $id, $updateFields); }it just updates one field but does not reorder anything.