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 ...@@ -350,11 +350,14 @@ class Course_RoomRequestsController extends AuthenticatedController
$this->step = (int)$step; $this->step = (int)$step;
$this->request = new RoomRequest($this->request_id); $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 // 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_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->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->category = $this->room_category_id ? ResourceCategory::find($this->room_category_id) : '';
$this->available_properties = $this->room_category_id ? $this->category->getRequestableProperties() : ''; $this->available_properties = $this->room_category_id ? $this->category->getRequestableProperties() : '';
...@@ -369,7 +372,10 @@ class Course_RoomRequestsController extends AuthenticatedController ...@@ -369,7 +372,10 @@ class Course_RoomRequestsController extends AuthenticatedController
$this->comment = $_SESSION[$request_id]['comment'] ?? null; $this->comment = $_SESSION[$request_id]['comment'] ?? null;
// when searching for a room name, list found room // 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['room_category_id'] = $this->room_category_id;
$search_properties['seats'] = [ $search_properties['seats'] = [
1, 1,
......
...@@ -16,13 +16,24 @@ ...@@ -16,13 +16,24 @@
<? endif ?> <? endif ?>
<? if ($step === 1 || $step === 2) : ?> <? if ($step === 1 || $step === 2) : ?>
<? if ($_SESSION[$request_id]['search_by'] !== 'category') : ?> <? if (
<? \Studip\Button::create(_('Raum auswählen'), 'select_room') ?> !isset($_SESSION[$request_id]['search_by'])
|| $_SESSION[$request_id]['search_by'] !== 'category'
) : ?>
<? \Studip\Button::create(_('Raum auswählen'), 'select_room') ?>
<? endif ?> <? endif ?>
<? endif ?> <? endif ?>
<? if (($step === 1 && $_SESSION[$request_id]['room_category_id'] !== '0') <? if (
|| $step === 2) : ?> (
$step === 1
&& (
!isset($_SESSION[$request_id]['room_category_id'])
|| $_SESSION[$request_id]['room_category_id'] !== '0'
)
)
|| $step === 2
) : ?>
<?= \Studip\Button::create(_('Weiter'), 'show_summary') ?> <?= \Studip\Button::create(_('Weiter'), 'show_summary') ?>
<? endif ?> <? endif ?>
......
...@@ -85,7 +85,7 @@ ...@@ -85,7 +85,7 @@
<label> <label>
<?= _('Raumname') ?> <?= _('Raumname') ?>
<span class="flex-row"> <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( <?= Icon::create('search')->asInput(
[ [
'title' => _('Räume suchen'), 'title' => _('Räume suchen'),
...@@ -107,7 +107,7 @@ ...@@ -107,7 +107,7 @@
<input type="radio" name="selected_room_id" <input type="radio" name="selected_room_id"
data-activates="button[type='submit'][name='select_room']" data-activates="button[type='submit'][name='select_room']"
value="<?= htmlReady($room->id) ?>" 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 . ')'?> <?= htmlReady(mila($room->name, 60)) . ' (' . $room['category']->name . ')'?>
<? if ($room->properties): ?> <? if ($room->properties): ?>
<? $property_names = $room->getInfolabelProperties() <? $property_names = $room->getInfolabelProperties()
......
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
<td> <td>
<? <?
$content = Studip\Markup::removeHtml($content); $content = Studip\Markup::removeHtml($content);
$ignore_next_hits = 0;
$offset = 0; $offset = 0;
$output = []; $output = [];
...@@ -55,7 +56,7 @@ ...@@ -55,7 +56,7 @@
break; break;
} }
$offset = $pos + 1; $offset = $pos + 1;
if (($ignore_next_hits--) > 0) { if ($ignore_next_hits-- > 0) {
// if more than one occurence is found // if more than one occurence is found
// in a fragment to be displayed, // in a fragment to be displayed,
// the fragment is only shown once // the fragment is only shown once
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
<? endif ?> <? endif ?>
<? endif ?> <? endif ?>
<footer data-dialog-button> <footer data-dialog-button>
<? if ($prev_request) : ?> <? if (!empty($prev_request)) : ?>
<?= \Studip\LinkButton::create( <?= \Studip\LinkButton::create(
_('Vorherige Anfrage'), _('Vorherige Anfrage'),
$controller->declineURL($prev_request), $controller->declineURL($prev_request),
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
<? if ($show_form) : ?> <? if ($show_form) : ?>
<?= \Studip\Button::createAccept($delete_mode ? _('Löschen') : _('Ablehnen'), 'confirm') ?> <?= \Studip\Button::createAccept($delete_mode ? _('Löschen') : _('Ablehnen'), 'confirm') ?>
<? endif ?> <? endif ?>
<? if ($next_request) : ?> <? if (!empty($next_request)) : ?>
<?= \Studip\LinkButton::create( <?= \Studip\LinkButton::create(
_('Nächste Anfrage'), _('Nächste Anfrage'),
$controller->declineURL($next_request), $controller->declineURL($next_request),
...@@ -53,4 +53,4 @@ ...@@ -53,4 +53,4 @@
) ?> ) ?>
<? endif ?> <? endif ?>
</footer> </footer>
</form> </form>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment