From e63b493f42262050662a2ea5f05bb438cf988ace Mon Sep 17 00:00:00 2001
From: Felix Pahlow <felix.pahlow@itz.uni-halle.de>
Date: Mon, 18 Sep 2023 15:50:07 +0000
Subject: [PATCH] =?UTF-8?q?Resolve=20#3195=20"Name=20der=20Veranstaltung?=
 =?UTF-8?q?=20in=20Terminl=C3=B6schungs-Nachricht"?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Closes #3195

Merge request studip/studip!2162
---
 lib/models/resources/ResourceBooking.class.php     | 5 +++++
 locale/de/LC_MAILS/delete_booking_notification.php | 4 ++++
 locale/en/LC_MAILS/delete_booking_notification.php | 4 ++++
 3 files changed, 13 insertions(+)

diff --git a/lib/models/resources/ResourceBooking.class.php b/lib/models/resources/ResourceBooking.class.php
index 779c4b5aae3..51c7aed422b 100644
--- a/lib/models/resources/ResourceBooking.class.php
+++ b/lib/models/resources/ResourceBooking.class.php
@@ -1892,6 +1892,10 @@ class ResourceBooking extends SimpleORMap implements PrivacyObject, Studip\Calen
 
         $booking_resource = Resource::find($this->resource_id);
         $booking_user = User::find($this->booking_user_id);
+        $booking_course = null;
+        if ($this->course_id) {
+            $booking_course = Course::find($this->course_id);
+        }
         if (!$booking_resource || !$booking_user) {
             //Nothing we can do here.
             return;
@@ -1913,6 +1917,7 @@ class ResourceBooking extends SimpleORMap implements PrivacyObject, Studip\Calen
         $template->set_attribute('begin', $this->begin);
         $template->set_attribute('end', $this->end);
         $template->set_attribute('deleting_user', User::findCurrent());
+        $template->set_attribute('booking_course', $booking_course);
 
         $mail_text = $template->render();
 
diff --git a/locale/de/LC_MAILS/delete_booking_notification.php b/locale/de/LC_MAILS/delete_booking_notification.php
index e3f80a07955..c5ef18d8133 100644
--- a/locale/de/LC_MAILS/delete_booking_notification.php
+++ b/locale/de/LC_MAILS/delete_booking_notification.php
@@ -6,6 +6,10 @@ Ihre Buchung der Ressource <?= $resource->name ?> am <?= date('d.m.Y', $begin) ?
  von <?= date('H:i', $begin) ?> bis <?= date('H:i', $end) ?> Uhr wurde gelöscht.
 <? endif ?>
 
+<? if ($booking_course instanceof Course): ?>
+Es handelte sich um eine Buchung für die Veranstaltung <?= $booking_course->getFullname() ?>.
+<? endif ?>
+
 <? if ($deleting_user instanceof User) : ?>
 Die Löschung wurde von <?= $deleting_user->getFullName() ?> vorgenommen.
 <? endif ?>
diff --git a/locale/en/LC_MAILS/delete_booking_notification.php b/locale/en/LC_MAILS/delete_booking_notification.php
index 3d98780b152..3e57aea57f0 100644
--- a/locale/en/LC_MAILS/delete_booking_notification.php
+++ b/locale/en/LC_MAILS/delete_booking_notification.php
@@ -6,6 +6,10 @@ Your booking of the resource <?= $resource->name ?> on <?= date('d.m.Y', $begin)
  from <?= date('H:i', $begin) ?> to <?= date('H:i', $end) ?> has been deleted.
 <? endif ?>
 
+<? if ($booking_course instanceof Course): ?>
+The booking deleted belonged to course <?= $booking_course->getFullname() ?>.
+<? endif ?>
+
 <? if ($deleting_user instanceof User) : ?>
 The deletion has been made by <?= $deleting_user->getFullName() ?>.
 <? endif ?>
-- 
GitLab