[BUGFIX] Disable edit of file metadata without translation 22/54822/2
authorŁukasz Uznański <l.uznanski@macopedia.pl>
Mon, 27 Nov 2017 10:15:00 +0000 (11:15 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Tue, 28 Nov 2017 10:31:20 +0000 (11:31 +0100)
This avoids an error in case file metadata is edited through a file
reference and there is no file metadata translation for the current
language.

Resolves: #76262
Resolves: #82178
Releases: master, 8.7
Change-Id: Ifecf659637773c5f3773fc3439b09df9c030cb3f
Reviewed-on: https://review.typo3.org/54822
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/backend/Classes/Form/Container/InlineRecordContainer.php

index a94fdd1..9e55258 100644 (file)
@@ -495,7 +495,7 @@ class InlineRecordContainer extends AbstractContainer
                     </a>';
             }
             // "Edit" link:
-            if (($rec['table_local'] === 'sys_file') && !$isNewItem) {
+            if (($rec['table_local'] === 'sys_file') && !$isNewItem && $backendUser->check('tables_modify', 'sys_file_metadata')) {
                 $sys_language_uid = 0;
                 if (!empty($rec['sys_language_uid'])) {
                     $sys_language_uid = $rec['sys_language_uid'][0];
@@ -518,7 +518,7 @@ class InlineRecordContainer extends AbstractContainer
                     ->setMaxResults(1)
                     ->execute()
                     ->fetch();
-                if ($backendUser->check('tables_modify', 'sys_file_metadata')) {
+                if (!empty($recordInDatabase)) {
                     $url = BackendUtility::getModuleUrl('record_edit', [
                         'edit[sys_file_metadata][' . (int)$recordInDatabase['uid'] . ']' => 'edit',
                         'returnUrl' => $this->data['returnUrl']