From 61935dc305280cbba760177ccaf1f4ae06de9675 Mon Sep 17 00:00:00 2001
From: Oliver Bartsch <bo@cedev.de>
Date: Wed, 11 Mar 2020 17:38:43 +0100
Subject: [PATCH] [BUGFIX] Provide inlineParentUid in FormInlineAjaxController
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

By expanding an inline record the AJAX request calls the `detailAction`
in `FormInlineAjaxController`. The parent data array created in this
function does not contain the parent record's uid nor its database row.

In order to ensure that the uid is not NULL, in any FormDataProvider,
the uid is now added to the parent data array. This value is then used
as fallback in case there is no database row given in the `compileChild`
function which calls the FormDataProviders.

Resolves: #90734
Releases: master, 9.5
Change-Id: I66a4a20980d6c62a3e87496b6261b25f5e22aea6
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/63686
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Susanne Moog <look@susi.dev>
Tested-by: Benni Mack <benni@typo3.org>
Reviewed-by: Christian Eßl <indy.essl@gmail.com>
Reviewed-by: Susanne Moog <look@susi.dev>
Reviewed-by: Benni Mack <benni@typo3.org>
---
 .../backend/Classes/Controller/FormInlineAjaxController.php    | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/typo3/sysext/backend/Classes/Controller/FormInlineAjaxController.php b/typo3/sysext/backend/Classes/Controller/FormInlineAjaxController.php
index f9a87a2b5757..90d1ffe25935 100644
--- a/typo3/sysext/backend/Classes/Controller/FormInlineAjaxController.php
+++ b/typo3/sysext/backend/Classes/Controller/FormInlineAjaxController.php
@@ -191,6 +191,7 @@ class FormInlineAjaxController extends AbstractFormEngineAjaxController
                     ],
                 ],
             ],
+            'uid' => $parent['uid'],
             'tableName' => $parent['table'],
             'inlineFirstPid' => $inlineFirstPid,
             // Hand over given original return url to compile stack. Needed if inline children compile links to
@@ -461,7 +462,7 @@ class FormInlineAjaxController extends AbstractFormEngineAjaxController
 
             // values of the current parent element
             // it is always a string either an id or new...
-            'inlineParentUid' => $parentData['databaseRow']['uid'],
+            'inlineParentUid' => $parentData['databaseRow']['uid'] ?? $parentData['uid'],
             'inlineParentTableName' => $parentData['tableName'],
             'inlineParentFieldName' => $parentFieldName,
 
-- 
GitLab