From 6595aa5413814dbfbf7da12765503cef7c79ffb1 Mon Sep 17 00:00:00 2001
From: Stefan Froemken <froemken@gmail.com>
Date: Fri, 19 Oct 2018 09:45:34 +0200
Subject: [PATCH] [BUGFIX] Show deleted records in recycler
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Show deleted records in recycler also when
related be_user was deleted completely from database.

Resolves: #86696
Releases: master
Change-Id: Idc16781ce4bb0c28be48cc86052738110c500165
Reviewed-on: https://review.typo3.org/58660
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Daniel Goerz <daniel.goerz@posteo.de>
Tested-by: Daniel Goerz <daniel.goerz@posteo.de>
Reviewed-by: Rudy Gnodde <rgn@windinternet.nl>
Reviewed-by: Ursula Klinger <klinger@punkt.de>
Tested-by: Ursula Klinger <klinger@punkt.de>
Tested-by: Eike Starkmann <starkmann@undkonsorten.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Jürgen Heym <juergen.heym@hof-university.de>
Tested-by: Jürgen Heym <juergen.heym@hof-university.de>
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
---
 .../Classes/Controller/DeletedRecordsController.php    | 10 +++++++++-
 .../recycler/Resources/Private/Language/locallang.xlf  |  3 +++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/typo3/sysext/recycler/Classes/Controller/DeletedRecordsController.php b/typo3/sysext/recycler/Classes/Controller/DeletedRecordsController.php
index 15294b475fe2..b7411c3fba89 100644
--- a/typo3/sysext/recycler/Classes/Controller/DeletedRecordsController.php
+++ b/typo3/sysext/recycler/Classes/Controller/DeletedRecordsController.php
@@ -23,6 +23,7 @@ use TYPO3\CMS\Core\DataHandling\History\RecordHistoryStore;
 use TYPO3\CMS\Core\Imaging\Icon;
 use TYPO3\CMS\Core\Imaging\IconFactory;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
 use TYPO3\CMS\Recycler\Utility\RecyclerUtility;
 
 /**
@@ -131,7 +132,14 @@ class DeletedRecordsController
             $username = $this->runtimeCache->get($cacheId);
         } else {
             $backendUser = BackendUtility::getRecord('be_users', $userId, 'username', '', false);
-            $username = $backendUser['username'];
+            if ($backendUser === null) {
+                $username = sprintf(
+                    '[%s]',
+                    LocalizationUtility::translate('LLL:EXT:recycler/Resources/Private/Language/locallang.xlf:record.deleted')
+                );
+            } else {
+                $username = $backendUser['username'];
+            }
             $this->runtimeCache->set($cacheId, $username);
         }
         return $username;
diff --git a/typo3/sysext/recycler/Resources/Private/Language/locallang.xlf b/typo3/sysext/recycler/Resources/Private/Language/locallang.xlf
index e0812d710c31..ee64303cc421 100644
--- a/typo3/sysext/recycler/Resources/Private/Language/locallang.xlf
+++ b/typo3/sysext/recycler/Resources/Private/Language/locallang.xlf
@@ -123,6 +123,9 @@
 			<trans-unit id="table.header.path">
 				<source>Path</source>
 			</trans-unit>
+			<trans-unit id="record.deleted">
+				<source>deleted</source>
+			</trans-unit>
 		</body>
 	</file>
 </xliff>
-- 
GitLab