From 625311458d48e01af704e2273b04907d5caea71a Mon Sep 17 00:00:00 2001
From: Viktoria Wiebe <vwiebe@uni-osnabrueck.de>
Date: Wed, 8 Jun 2022 13:15:01 +0000
Subject: [PATCH] biest #1072

Closes #1072

Merge request studip/studip!682
---
 lib/models/resources/ResourceBooking.class.php | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/lib/models/resources/ResourceBooking.class.php b/lib/models/resources/ResourceBooking.class.php
index d7c1b2f8b9a..548f86d52bc 100644
--- a/lib/models/resources/ResourceBooking.class.php
+++ b/lib/models/resources/ResourceBooking.class.php
@@ -445,13 +445,6 @@ class ResourceBooking extends SimpleORMap implements PrivacyObject, Studip\Calen
             );
         }
 
-        if ((!$this->booking_user_id) || !($this->booking_user instanceof User)) {
-            /*throw new InvalidArgumentException(
-                _('Die buchende Person wurde nicht gesetzt!')
-            );*/
-            $this->booking_user = User::findCurrent();
-        }
-
         if ($this->begin >= $this->end) {
             throw new InvalidArgumentException(
                 _('Der Startzeitpunkt darf nicht hinter dem Endzeitpunkt liegen!')
@@ -471,6 +464,9 @@ class ResourceBooking extends SimpleORMap implements PrivacyObject, Studip\Calen
             }
         }
 
+        // update the booking user
+        $this->booking_user = User::findCurrent();
+    
         //Check if the user has booking rights on the resource.
         //The user must have either permanent permissions or they have to
         //have booking rights by a temporary permission in this moment
-- 
GitLab