diff --git a/app/controllers/course/room_requests.php b/app/controllers/course/room_requests.php index cdf8b1dcb433f0b8dd9de020e9c25735373bbc66..a6c7a44638ba0f050c29e16732dbaecefa396818 100644 --- a/app/controllers/course/room_requests.php +++ b/app/controllers/course/room_requests.php @@ -350,11 +350,14 @@ class Course_RoomRequestsController extends AuthenticatedController $this->step = (int)$step; $this->request = new RoomRequest($this->request_id); - $this->request->setRangeFields($_SESSION[$this->request_id]['range'], $_SESSION[$this->request_id]['range_ids']); + $this->request->setRangeFields( + $_SESSION[$this->request_id]['range'] ?? null, + $_SESSION[$this->request_id]['range_ids'] ?? null + ); // let's find all the properties belonging to the selected category $this->room_category_id = $_SESSION[$request_id]['room_category_id'] ?: $this->request->category_id; - $this->room_name = $_SESSION[$request_id]['room_name']; + $this->room_name = $_SESSION[$request_id]['room_name'] ?? ''; $this->selected_room = Resource::find($_SESSION[$request_id]['room_id'] ?: $this->request->resource_id); $this->category = $this->room_category_id ? ResourceCategory::find($this->room_category_id) : ''; $this->available_properties = $this->room_category_id ? $this->category->getRequestableProperties() : ''; @@ -369,7 +372,10 @@ class Course_RoomRequestsController extends AuthenticatedController $this->comment = $_SESSION[$request_id]['comment'] ?? null; // when searching for a room name, list found room - if ($_SESSION[$request_id]['room_name'] !== '') { + if ( + isset($_SESSION[$request_id]['room_name']) + && $_SESSION[$request_id]['room_name'] !== '' + ) { $search_properties['room_category_id'] = $this->room_category_id; $search_properties['seats'] = [ 1, diff --git a/app/views/course/room_requests/_new_request_form_footer.php b/app/views/course/room_requests/_new_request_form_footer.php index 4b847905002392558febd113aafd6e2b14a5a88d..0bad0763b6304acdefe0600801392137368ef250 100644 --- a/app/views/course/room_requests/_new_request_form_footer.php +++ b/app/views/course/room_requests/_new_request_form_footer.php @@ -16,13 +16,24 @@ <? endif ?> <? if ($step === 1 || $step === 2) : ?> - <? if ($_SESSION[$request_id]['search_by'] !== 'category') : ?> - <? \Studip\Button::create(_('Raum auswählen'), 'select_room') ?> + <? if ( + !isset($_SESSION[$request_id]['search_by']) + || $_SESSION[$request_id]['search_by'] !== 'category' + ) : ?> + <? \Studip\Button::create(_('Raum auswählen'), 'select_room') ?> <? endif ?> <? endif ?> - <? if (($step === 1 && $_SESSION[$request_id]['room_category_id'] !== '0') - || $step === 2) : ?> + <? if ( + ( + $step === 1 + && ( + !isset($_SESSION[$request_id]['room_category_id']) + || $_SESSION[$request_id]['room_category_id'] !== '0' + ) + ) + || $step === 2 + ) : ?> <?= \Studip\Button::create(_('Weiter'), 'show_summary') ?> <? endif ?> diff --git a/app/views/course/room_requests/request_find_matching_rooms.php b/app/views/course/room_requests/request_find_matching_rooms.php index 0a11aeb45976aeea3d121c07f98830f36539c931..ce24e0f4fa85562b969fe6816053b1c613da5a48 100644 --- a/app/views/course/room_requests/request_find_matching_rooms.php +++ b/app/views/course/room_requests/request_find_matching_rooms.php @@ -85,7 +85,7 @@ <label> <?= _('Raumname') ?> <span class="flex-row"> - <input type="text" name="room_name" value="<?= htmlReady($_SESSION[$request_id]['room_name']) ?>"> + <input type="text" name="room_name" value="<?= htmlReady($_SESSION[$request_id]['room_name'] ?? '') ?>"> <?= Icon::create('search')->asInput( [ 'title' => _('Räume suchen'), @@ -107,7 +107,7 @@ <input type="radio" name="selected_room_id" data-activates="button[type='submit'][name='select_room']" value="<?= htmlReady($room->id) ?>" - <? if ($_SESSION[$request_id]['room_id'] === $room->id) echo 'checked' ?>> + <? if (isset($_SESSION[$request_id]['room_id']) && $_SESSION[$request_id]['room_id'] === $room->id) echo 'checked' ?>> <?= htmlReady(mila($room->name, 60)) . ' (' . $room['category']->name . ')'?> <? if ($room->properties): ?> <? $property_names = $room->getInfolabelProperties() diff --git a/app/views/course/wiki/search.php b/app/views/course/wiki/search.php index 27811eb56bdd1d9b13e73c284e50f84b2ed0628e..daf88fe113c7995f6d55d727a9e2d7f3fef0a548 100644 --- a/app/views/course/wiki/search.php +++ b/app/views/course/wiki/search.php @@ -45,6 +45,7 @@ <td> <? $content = Studip\Markup::removeHtml($content); + $ignore_next_hits = 0; $offset = 0; $output = []; @@ -55,7 +56,7 @@ break; } $offset = $pos + 1; - if (($ignore_next_hits--) > 0) { + if ($ignore_next_hits-- > 0) { // if more than one occurence is found // in a fragment to be displayed, // the fragment is only shown once diff --git a/app/views/resources/room_request/decline.php b/app/views/resources/room_request/decline.php index 188c4bba0728c8c7100c7f4f1a3138f620a991ee..2c02126bc83229c3173b37bf80053b8fbe344324 100644 --- a/app/views/resources/room_request/decline.php +++ b/app/views/resources/room_request/decline.php @@ -30,7 +30,7 @@ <? endif ?> <? endif ?> <footer data-dialog-button> - <? if ($prev_request) : ?> + <? if (!empty($prev_request)) : ?> <?= \Studip\LinkButton::create( _('Vorherige Anfrage'), $controller->declineURL($prev_request), @@ -45,7 +45,7 @@ <? if ($show_form) : ?> <?= \Studip\Button::createAccept($delete_mode ? _('Löschen') : _('Ablehnen'), 'confirm') ?> <? endif ?> - <? if ($next_request) : ?> + <? if (!empty($next_request)) : ?> <?= \Studip\LinkButton::create( _('Nächste Anfrage'), $controller->declineURL($next_request), @@ -53,4 +53,4 @@ ) ?> <? endif ?> </footer> -</form> \ No newline at end of file +</form>