[BUGFIX] Handle broken refindex in Element Information popup 54/42154/3
authorMarkus Klein <markus.klein@typo3.org>
Thu, 30 Jul 2015 22:01:35 +0000 (00:01 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Thu, 30 Jul 2015 22:57:06 +0000 (00:57 +0200)
Releases: master
Resolves: #68601
Change-Id: I7a9092bdec5ad43564c1e3abd576d26f2b8d7685
Reviewed-on: http://review.typo3.org/42154
Reviewed-by: Josef Glatz <jousch@gmail.com>
Tested-by: Josef Glatz <jousch@gmail.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/backend/Classes/Controller/ContentElement/ElementInformationController.php

index 559686c..2acc0ad 100644 (file)
@@ -681,7 +681,7 @@ class ElementInformationController {
                                $infoData[] = '
                                <tr>
                                        <td class="col-icon"></td>
-                                       <td class="col-title">' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:show_item.php.missing_record') . ' (uid=' . $row['recuid'] . ')</td>
+                                       <td class="col-title">' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:show_item.php.missing_record') . ' (uid=' . (int)$row['recuid'] . ')</td>
                                        <td>' . htmlspecialchars($lang->sL($GLOBALS['TCA'][$row['tablename']]['ctrl']['title']) ?: $row['tablename']) . '</td>
                                        <td></td>
                                        <td>' . htmlspecialchars($this->getLabelForTableColumn($row['tablename'], $row['field'])) . '</td>
@@ -740,10 +740,11 @@ class ElementInformationController {
                }
                foreach ($rows as $row) {
                        $record = BackendUtility::getRecord($row['ref_table'], $row['ref_uid']);
-                       $icon = IconUtility::getSpriteIconForRecord($row['tablename'], $record);
-                       $actions = $this->getRecordActions($row['ref_table'], $row['ref_uid']);
-                       $editOnClick = BackendUtility::editOnClick('&edit[' . $row['ref_table'] . '][' . $row['ref_uid'] . ']=edit');
-                       $infoData[] = '
+                       if ($record) {
+                               $icon = IconUtility::getSpriteIconForRecord($row['tablename'], $record);
+                               $actions = $this->getRecordActions($row['ref_table'], $row['ref_uid']);
+                               $editOnClick = BackendUtility::editOnClick('&edit[' . $row['ref_table'] . '][' . $row['ref_uid'] . ']=edit');
+                               $infoData[] = '
                                <tr>
                                        <td class="col-icon">
                                                <a href="#" onclick="' . htmlspecialchars($editOnClick) . '" title="id=' . $record['uid'] . '">
@@ -764,6 +765,21 @@ class ElementInformationController {
                                        <td>' . htmlspecialchars($row['ref_string']) . '</td>
                                        <td class="col-control">' . $actions . '</td>
                                </tr>';
+                       } else {
+                               $infoData[] = '
+                               <tr>
+                                       <td class="col-icon"></td>
+                                       <td class="col-title">' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:show_item.php.missing_record') . ' (uid=' . (int)$row['recuid'] . ')</td>
+                                       <td>' . $lang->sL($GLOBALS['TCA'][$row['ref_table']]['ctrl']['title'], TRUE) . '</td>
+                                       <td></td>
+                                       <td>' . htmlspecialchars($this->getLabelForTableColumn($table, $row['field'])) . '</td>
+                                       <td>' . htmlspecialchars($row['flexpointer']) . '</td>
+                                       <td>' . htmlspecialchars($row['softref_key']) . '</td>
+                                       <td>' . htmlspecialchars($row['sorting']) . '</td>
+                                       <td>' . htmlspecialchars($row['ref_string']) . '</td>
+                                       <td class="col-control"></td>
+                               </tr>';
+                       }
                }
 
                if (empty($infoData)) {