Project

General

Profile

Actions

Bug #68040

open

Inline localize and/or synchronize does not respect sorting

Added by Jo Hasenau almost 9 years ago. Updated 10 months ago.

Status:
Under Review
Priority:
Must have
Assignee:
-
Category:
FormEngine aka TCEforms
Start date:
2018-03-14
Due date:
2018-03-14 (over 6 years late)
% Done:

0%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
medium
Is Regression:
No
Sprint Focus:

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.


Files

68040_current.png (42.3 KB) 68040_current.png Oliver Hader, 2015-10-19 20:55

Related issues 7 (0 open7 closed)

Related to TYPO3 Core - Bug #43158: Sorting of parent records also moves inline childsClosed2012-11-20

Actions
Related to TYPO3 Core - Bug #75400: Related child elements don't get correct sys_language_uid during localization of parent recordClosedJo Hasenau2016-04-04

Actions
Related to TYPO3 Core - Bug #83079: wrong sorting of content elements when translating using non-default-language CEs as sourceClosed2017-11-24

Actions
Related to TYPO3 Core - Bug #83469: Translation of translations break sorting in tt_contentClosed2018-01-04

Actions
Related to TYPO3 Core - Bug #50310: DataHandler fails to correctly re-sort (content) elements after moving one to topClosed2013-07-22

Actions
Has duplicate TYPO3 Core - Bug #82109: Sorting of CEs in translation is wrong when localizing new CEs within gridelementsClosed2017-08-16

Actions
Follows TYPO3 Core - Bug #84228: Output error reasons if Build/Scripts/checkIntegrityCsvFixtures.php failsClosedMarkus Klein2018-03-13

Actions
Actions #1

Updated by Jo Hasenau almost 9 years ago

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

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.

Actions #2

Updated by Jo Hasenau almost 9 years ago

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.

Actions #3

Updated by Oliver Hader over 8 years ago

Is that the behavior your referring to (see screenshot)?

Actions #4

Updated by Mathias Schreiber over 8 years ago

  • Target version deleted (next-patchlevel)
Actions #5

Updated by Jo Hasenau over 8 years ago

Exactly this is the problem

Actions #6

Updated by Jo Hasenau over 6 years ago

  • Has duplicate Bug #82109: Sorting of CEs in translation is wrong when localizing new CEs within gridelements added
Actions #7

Updated by Andreas Wolf over 6 years ago

I investigated this and found the culprit: It’s RelationHandler, not DataHandler. 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 by DataHandler::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.

Actions #8

Updated by Andreas Wolf over 6 years ago

Andreas Wolf wrote:

The sorting is then messed up by RelationHandler::writeForeignField(), which is called by DataHandler::inlineLocalizeSynchronize().

Further research and tests showed that this is incorrect. writeForeignField() is called by DataHandler::remapListedDBRecords_procInline() when processing the translated Gridelements container.

The value processed in remapListedDBRecords_procInline comes from DataHandler->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, a RelationHandler instance used in DataHandler::inlineLocalizeSynchronize()

Actions #9

Updated by Gerrit Code Review over 6 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/53739

Actions #10

Updated by Gerrit Code Review over 6 years ago

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

Actions #11

Updated by Gerrit Code Review over 6 years ago

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

Actions #12

Updated by Gerrit Code Review over 6 years ago

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

Actions #13

Updated by Gerrit Code Review over 6 years ago

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

Actions #14

Updated by Markus Klein about 6 years ago

  • Assignee deleted (Jo Hasenau)
  • Target version set to 8.7.11
Actions #15

Updated by Gerrit Code Review about 6 years ago

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

Actions #16

Updated by Gerrit Code Review about 6 years ago

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

Actions #17

Updated by Markus Klein about 6 years ago

  • Due date set to 2018-03-14
  • Start date changed from 2015-07-10 to 2018-03-14
  • Follows Bug #84228: Output error reasons if Build/Scripts/checkIntegrityCsvFixtures.php fails added
Actions #18

Updated by Oliver Hader about 6 years ago

  • Target version changed from 8.7.11 to 8.7.12
Actions #19

Updated by Gerrit Code Review about 6 years ago

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

Actions #20

Updated by Susanne Moog about 6 years ago

  • Related to Bug #83079: wrong sorting of content elements when translating using non-default-language CEs as source added
Actions #21

Updated by Sybille Peters about 6 years ago

I'm adding a reproduce scenario. I used bootstrap carousel from bootstrap_package for testing.

  1. Create an element of type bootstrap carousel.
  2. Add 2 IRRE elements ("Carousel item")
  3. Translate the element with mode "Translate"
  4. Add another IRRE element in the content element of the original language
  5. Move the new IRRE element from third to second place
  6. 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!"

Actions #22

Updated by Benni Mack almost 6 years ago

  • Target version changed from 8.7.12 to 8.7.19
Actions #23

Updated by Tymoteusz Motylewski over 5 years ago

  • Related to Bug #83469: Translation of translations break sorting in tt_content added
Actions #24

Updated by Susanne Moog over 5 years ago

  • Target version changed from 8.7.19 to Candidate for patchlevel
Actions #25

Updated by Gerrit Code Review over 5 years ago

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

Actions #26

Updated by Gerrit Code Review over 5 years ago

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

Actions #27

Updated by Gerrit Code Review over 5 years ago

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

Actions #28

Updated by Gerrit Code Review over 5 years ago

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

Actions #29

Updated by Gerrit Code Review almost 4 years ago

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

Actions #30

Updated by Benni Mack over 3 years ago

  • Related to Bug #50310: DataHandler fails to correctly re-sort (content) elements after moving one to top added
Actions #31

Updated by Gerrit Code Review over 2 years ago

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

Actions #32

Updated by Gerrit Code Review over 2 years ago

Patch set 15 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/53739

Actions #33

Updated by Gerrit Code Review over 2 years ago

Patch set 16 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/53739

Actions #34

Updated by Gerrit Code Review 12 months ago

Patch set 17 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/53739

Actions #35

Updated by Gerrit Code Review 10 months ago

Patch set 18 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/53739

Actions #36

Updated by Gerrit Code Review 10 months ago

Patch set 19 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/53739

Actions #37

Updated by Gerrit Code Review 10 months ago

Patch set 20 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/53739

Actions #38

Updated by Gerrit Code Review 10 months ago

Patch set 21 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/53739

Actions #39

Updated by Gerrit Code Review 10 months ago

Patch set 22 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/53739

Actions

Also available in: Atom PDF