From e48767859758c9e12cf464313ca104482d5bec4d Mon Sep 17 00:00:00 2001
From: Jan-Hendrik Willms <tleilax+studip@gmail.com>
Date: Mon, 27 May 2024 05:47:15 +0000
Subject: [PATCH] fixes #4210

Closes #4210

Merge request studip/studip!3040
---
 app/controllers/resources/booking.php          | 2 +-
 app/views/admin/lockrules/_form.php            | 8 +++++---
 app/views/resources/booking/_add_edit_form.php | 2 +-
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/app/controllers/resources/booking.php b/app/controllers/resources/booking.php
index 45ccb16fa7e..a4722eda5c9 100644
--- a/app/controllers/resources/booking.php
+++ b/app/controllers/resources/booking.php
@@ -1352,7 +1352,7 @@ class Resources_BookingController extends AuthenticatedController
                     $resource,
                     $time_intervals,
                     [1, 3],
-                    ($this->booking->id ? [$this->booking->id] : [])
+                    isset($this->booking->id) ? [$this->booking->id] : []
                 );
                 $reservations_to_overwrite = array_merge(
                     $reservations_to_overwrite,
diff --git a/app/views/admin/lockrules/_form.php b/app/views/admin/lockrules/_form.php
index c4ef11143bd..b96c7b6032a 100644
--- a/app/views/admin/lockrules/_form.php
+++ b/app/views/admin/lockrules/_form.php
@@ -85,12 +85,14 @@ use Studip\Button;
                         </td>
                         <td>
                             <input type="radio"
-                                   name="lockdata_attributes[<?= $attr ?>]" <?= ($lock_rule['attributes'][$attr] ? 'checked' : '') ?>
-                                   value="1"/>
+                                   name="lockdata_attributes[<?= $attr ?>]"
+                                   <?= !empty($lock_rule['attributes'][$attr]) ? 'checked' : '' ?>
+                                   value="1">
                         </td>
                         <td>
                             <input type="radio"
-                                   name="lockdata_attributes[<?= $attr ?>]" <?= (!$lock_rule['attributes'][$attr] ? 'checked' : '') ?>
+                                   name="lockdata_attributes[<?= $attr ?>]"
+                                   <?= empty($lock_rule['attributes'][$attr]) ? 'checked' : '' ?>
                                    value="0"/>
                         </td>
                     </tr>
diff --git a/app/views/resources/booking/_add_edit_form.php b/app/views/resources/booking/_add_edit_form.php
index 571ff63f0ed..f982c377b58 100644
--- a/app/views/resources/booking/_add_edit_form.php
+++ b/app/views/resources/booking/_add_edit_form.php
@@ -537,7 +537,7 @@
                 <label>
                     <input type="checkbox" value="1"
                            name="overwrite_bookings"
-                        <?= $overwrite_bookings ? 'checked="checked"' : '' ?>>
+                        <?= !empty($overwrite_bookings) ? 'checked' : '' ?>>
                     <?= _('Vorhandene Buchungen überschreiben') ?>
                 </label>
             </fieldset>
-- 
GitLab