From bd65b830f919e93d46028e72aeaa29d180189a20 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Noack?= <noack@data-quest.de>
Date: Wed, 19 Jul 2023 09:09:44 +0000
Subject: [PATCH] =?UTF-8?q?Resolve=20#2938=20"Manuelle=20Buchung:=20Alle?=
 =?UTF-8?q?=20R=C3=A4ume=20werden=20als=20Teilraum=20angezeigt"?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Closes #2938

Merge request studip/studip!1979
---
 app/controllers/resources/booking.php | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/app/controllers/resources/booking.php b/app/controllers/resources/booking.php
index 63d126168d6..145a885a2a5 100644
--- a/app/controllers/resources/booking.php
+++ b/app/controllers/resources/booking.php
@@ -633,7 +633,7 @@ class Resources_BookingController extends AuthenticatedController
     {
         $this->current_user = User::findCurrent();
 
-        $only_one_room = null;
+        $only_one_room = true;
 
         if (Request::submitted('semester_id')) {
             URLHelper::addLinkParam('semester_id', Request::get('semester_id'));
@@ -927,14 +927,12 @@ class Resources_BookingController extends AuthenticatedController
 
             if ($resource instanceof Room) {
                 $other_room_parts = Room::findOtherRoomParts($resource);
-                $simple_message = true;
                 if ($other_room_parts) {
                     $this->other_room_parts[$resource->id] = $other_room_parts;
                     $this->separable_rooms_selected = true;
 
-                    if ($only_one_room and $other_room_parts) {
+                    if ($only_one_room) {
                         //If there is only one room we can be informative.
-                        $simple_message = false;
                         $other_room_links = [];
                         foreach ($other_room_parts as $room_part) {
                             $other_room_links[] = sprintf(
@@ -950,14 +948,13 @@ class Resources_BookingController extends AuthenticatedController
                             ', ',
                             $other_room_links
                         );
+                    } else {
+                        $separable_room_messages[] = sprintf(
+                            _('Der Raum %1$s ist ein Teilraum eines teilbaren Raumes.'),
+                            htmlReady($resource->name)
+                        );
                     }
                 }
-                if ($simple_message) {
-                    $separable_room_messages[] = sprintf(
-                        _('Der Raum %1$s ist ein Teilraum eines teilbaren Raumes.'),
-                        htmlReady($resource->name)
-                    );
-                }
             }
         }
 
-- 
GitLab