From 53093b02c8ba360c21330b0c77595d3cc62ea60c Mon Sep 17 00:00:00 2001
From: Jan-Hendrik Willms <tleilax+studip@gmail.com>
Date: Thu, 7 Mar 2024 13:41:28 +0000
Subject: [PATCH] fixes #3782

Closes #3782

Merge request studip/studip!2654
---
 lib/models/resources/ResourcePropertyDefinition.class.php | 3 ++-
 templates/sidebar/room-search-criteria.php                | 6 +++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/lib/models/resources/ResourcePropertyDefinition.class.php b/lib/models/resources/ResourcePropertyDefinition.class.php
index 04c492444e4..d2d7bf64ea4 100644
--- a/lib/models/resources/ResourcePropertyDefinition.class.php
+++ b/lib/models/resources/ResourcePropertyDefinition.class.php
@@ -107,7 +107,8 @@ class ResourcePropertyDefinition extends SimpleORMap
     public function getOptionsArray()
     {
         if ($this->options) {
-            return explode(';', $this->options);
+            $options = explode(';', $this->options);
+            return array_combine($options, $options);
         }
         return [];
     }
diff --git a/templates/sidebar/room-search-criteria.php b/templates/sidebar/room-search-criteria.php
index 383068188e0..afe4f9ecfcb 100644
--- a/templates/sidebar/room-search-criteria.php
+++ b/templates/sidebar/room-search-criteria.php
@@ -64,9 +64,9 @@
             <?= htmlReady($criteria['title']) ?>
             <select name="<?= htmlReady($criteria['name']) ?>">
                 <? if (is_array($criteria['options'])): ?>
-                    <? foreach ($criteria['options'] as $title): ?>
-                        <option value="<?= htmlReady($title) ?>"
-                                <?= $title == $criteria['value'] ? 'selected' : '' ?>
+                    <? foreach ($criteria['options'] as $value => $title): ?>
+                        <option value="<?= htmlReady($value) ?>"
+                                <?= $value == $criteria['value'] ? 'selected' : '' ?>
                         >
                             <?= htmlReady($title) ?>
                         </option>
-- 
GitLab