Commit 65f634e9 authored by Benni Mack's avatar Benni Mack Committed by Tymoteusz Motylewski
Browse files

[BUGFIX] IRRE actions should render error messages from DataHandler

When IRRE actions (localize/synchronize) are triggered that result in a
DataHandler error (e.g. "Localization failed, "languageField" and
"transOrigPointerField" must be defined for the table") because of a missing
configuration, the current implementation does not evaluate DataHandler
results in the JSON response.

The change adds the same functionality as for other DataHandler calls
to evaluate the JSON response.

Resolves: #83011
Releases: master, 8.7
Change-Id: I7a2069b78cd9c3fa031b7ac194ae5b18596b6a3e
Reviewed-on: https://review.typo3.org/54659


Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: Jan Helke's avatarJan Helke <typo3@helke.de>
Tested-by: Jan Helke's avatarJan Helke <typo3@helke.de>
Reviewed-by: Tymoteusz Motylewski's avatarTymoteusz Motylewski <t.motylewski@gmail.com>
Tested-by: Tymoteusz Motylewski's avatarTymoteusz Motylewski <t.motylewski@gmail.com>
parent bb87f5d1
......@@ -23,6 +23,8 @@ use TYPO3\CMS\Backend\Form\InlineStackProcessor;
use TYPO3\CMS\Backend\Form\NodeFactory;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\CMS\Core\DataHandling\DataHandler;
use TYPO3\CMS\Core\Messaging\AbstractMessage;
use TYPO3\CMS\Core\Messaging\FlashMessageService;
use TYPO3\CMS\Core\Utility\ArrayUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\MathUtility;
......@@ -348,6 +350,23 @@ class FormInlineAjaxController extends AbstractFormEngineAjaxController
$oldItems = $this->getInlineRelatedRecordsUidArray($oldItemList);
$newItems = $this->getInlineRelatedRecordsUidArray($newItemList);
// Render error messages from DataHandler
$tce->printLogErrorMessages();
$flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class);
$messages = $flashMessageService->getMessageQueueByIdentifier()->getAllMessagesAndFlush();
if (!empty($messages)) {
foreach ($messages as $message) {
$jsonArray['messages'][] = [
'title' => $message->getTitle(),
'message' => $message->getMessage(),
'severity' => $message->getSeverity()
];
if ($message->getSeverity() === AbstractMessage::ERROR) {
$jsonArray['hasErrors'] = true;
}
}
}
// Set the items that should be removed in the forms view:
$removedItems = array_diff($oldItems, $newItems);
foreach ($removedItems as $childUid) {
......
......@@ -233,6 +233,11 @@ var inline = {
if (!json && xhr) {
json = xhr.responseJSON;
}
if (json.hasErrors) {
$.each(json.messages, function(position, message) {
top.TYPO3.Notification.error(message.title, message.message);
});
}
// If there are elements the should be added to the <HEAD> tag (e.g. for RTEhtmlarea):
if (json.stylesheetFiles) {
$.each(json.stylesheetFiles, function (index, stylesheetFile) {
......
Supports Markdown
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