[BUGFIX] Disable edit of file metadata without translation 68/56568/2
authorŁukasz Uznański <l.uznanski@macopedia.pl>
Mon, 27 Nov 2017 10:15:00 +0000 (11:15 +0100)
committerMathias Brodala <mbrodala@pagemachine.de>
Fri, 6 Jul 2018 12:38:37 +0000 (14:38 +0200)
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, 7.6
Change-Id: Ifecf659637773c5f3773fc3439b09df9c030cb3f
Reviewed-on: https://review.typo3.org/56568
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Alexander Stehlik <alexander.stehlik@gmail.com>
Tested-by: Alexander Stehlik <alexander.stehlik@gmail.com>
Reviewed-by: Stephan Großberndt <stephan.grossberndt@typo3.org>
Reviewed-by: Rudy Gnodde <rgn@windinternet.nl>
Reviewed-by: Mathias Brodala <mbrodala@pagemachine.de>
Tested-by: Mathias Brodala <mbrodala@pagemachine.de>
typo3/sysext/backend/Classes/Form/Container/InlineRecordContainer.php

index 7f8dd86..ac0a3ef 100644 (file)
@@ -464,7 +464,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];
@@ -474,7 +474,7 @@ class InlineRecordContainer extends AbstractContainer
                     'sys_file_metadata',
                     'file = ' . (int)substr($rec['uid_local'], 9) . ' AND sys_language_uid = ' . $sys_language_uid
                 );
-                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' => GeneralUtility::getIndpEnv('REQUEST_URI')