Skip to content
Snippets Groups Projects
Commit bd02b4b6 authored by Christian Kuhn's avatar Christian Kuhn
Browse files

[BUGFIX] Honor workspace l10n_parent can point to live

When a record localization is changed in workspaces,
`transOrigPointerField` ("l10n_parent") can point to
either the default language -live-, OR default language
-workspace- record, depending on workspace action chains
as detailed below.

FormEngine did not deal with that properly when
`showPossibleLocalizationRecords` for inline (or file)
children is enabled, and did tend to show a possible
localization child even though a record has been localized
already ("shown twice"). This issue exists for a long
time already, but became more obvious with #94623, which
enabled `showPossibleLocalizationRecords` for tt_content
image.

The main fix of the patch is to make FormEngine aware
of this scenario and suppress listing a localized
workspace record as "can be synchronized" when its
l10n_parent field points to live.

As drive-by, the patch fixes a missing reference index update
call in DH when "synchronizing" a relation in workspaces.

The patch also adds some `@todo`s to point out situations
where the "parent count" fields are incorrect.

The added tests show scenarios where a localized workspace
record points to either its live, or its workspace default
language "parent" in the "l10n_parent" field. We're adding
the tests for FAL, but the situation is similar with parent
(here: tt_content), with inline csv and inline foreign field:

a) modifyContentLocalizeAddDefaultLangRelationSynchronize()
   Having a content element and a localization in live. Add an
   image in workspace default language and synchronize into
   workspace localized record: l10n_parent of new localized
   sys_file_reference points to the workspace sys_file_reference
   record. This is quite obvious, since there is no live record
   to point to.

b) localizeLiveModifyWsLocalizationAddLiveWsSync()
   Having a content element and a localization in live. Modify
   the localization in workspaces, by for instance changing the
   title of the content element. This creates a workspace
   overlay of that localized element in workspaces. Then add
   an image to the default language live content element, and
   synchronize this in the localized workspace element. Now,
   l10n_parent of the new localized sys_file_reference points
   to the live sys_file_reference record. This is because an
   overlay of the default language record does not exist.

c) localizeLiveModifyWsDefaultLang()
   Having a content element with image and a localization in
   live. Modify the default content element in workspaces, by
   for instance changing the title of the content element. This
   creates workspace overlays of the default language record,
   *and* overlays of the localized content elements. It also
   creates overlays of the attached images in both the default
   language record and its localizations. l10n_parent of the
   sys_file_reference localized records now point to the live
   version. This scenario is debatable since overlays of the
   default language record exist. We decided to keep this
   behavior, since we'd otherwise have to deal with
   updating these pointers when publishing localizations.

Change-Id: Iaab27586ff19cdc5f491324ca6dbc2cceff73373
Resolves: #97548
Resolves: #89858
Related: #94623
Releases: main, 12.4
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/83165


Tested-by: default avatarcore-ci <typo3@b13.com>
Tested-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
parent 5e856cc6
Showing
with 1279 additions and 24 deletions
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment