From 56afc5f404b28eee74d97c2f58e13facc5c1ea94 Mon Sep 17 00:00:00 2001
From: Rasmus Fuhse <fuhse@data-quest.de>
Date: Thu, 3 Nov 2022 09:03:34 +0000
Subject: [PATCH] =?UTF-8?q?Resolve=20"Fehler=20bei=20Terminvergabe,=20wenn?=
 =?UTF-8?q?=20Nutzer=20gel=C3=B6scht=20wird"?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Closes #1683

Merge request studip/studip!1087
---
 lib/models/ConsultationSlot.php | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/models/ConsultationSlot.php b/lib/models/ConsultationSlot.php
index 217631128dc..f1063ce1161 100644
--- a/lib/models/ConsultationSlot.php
+++ b/lib/models/ConsultationSlot.php
@@ -258,7 +258,7 @@ class ConsultationSlot extends SimpleORMap
 
                     $event->event->summary = sprintf(
                         _('Termin mit %s'),
-                        $booking->user->getFullName()
+                        $booking->user ? $booking->user->getFullName() : _('unbekannt')
                     );
                     $event->event->description = $booking->reason;
                 } else {
@@ -267,7 +267,8 @@ class ConsultationSlot extends SimpleORMap
                         count($bookings)
                     );
                     $event->event->description = implode("\n\n----\n\n", $bookings->map(function ($booking) {
-                        return "- {$booking->user->getFullName()}:\n{$booking->reason}";
+                        $name = $booking->user ? $booking->user->getFullName() : _('unbekannt');
+                        return "- {$name}:\n{$booking->reason}";
                     }));
                 }
             } else {
-- 
GitLab