Skip to content
Snippets Groups Projects
Commit 21ccc143 authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms
Browse files

fixes #4012

Closes #4012

Merge request studip/studip!2864
parent cb7224d6
No related branches found
No related tags found
No related merge requests found
......@@ -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,
......
......@@ -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 ?>
......
......@@ -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()
......
......@@ -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
......
......@@ -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>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment