Skip to content
Snippets Groups Projects
Commit 9b30eed0 authored by Elmar Ludwig's avatar Elmar Ludwig
Browse files

select the correct rooms when resolving a room request, fixes #710

Closes #710

Merge request studip/studip!590
parent 73fa6233
No related branches found
No related tags found
No related merge requests found
......@@ -1186,10 +1186,7 @@ class Resources_RoomRequestController extends AuthenticatedController
$room,
[$interval]
);
if ($interval_available[0]) {
$range_index = $interval['range'] . '_' . $interval['range_id'];
$this->selected_rooms[$range_index] = $room->id;
} else {
if (!$interval_available[0]) {
$this->unavailable_dates[$room->id]++;
$this->unavailable_metadate_dates[$room->id][$metadate_id]++;
}
......@@ -1397,7 +1394,7 @@ class Resources_RoomRequestController extends AuthenticatedController
}
$this->alternatives_selection = 'room_search';
if (Request::submitted('select_alternatives')) {
if (Request::get('alternatives_selection')) {
CSRFProtection::verifyUnsafeRequest();
$this->selected_rooms = Request::getArray('selected_rooms');
$this->alternatives_selection = Request::get('alternatives_selection');
......
......@@ -272,7 +272,7 @@
<input type="radio" name="<?= htmlReady($room_radio_name) ?>"
class="text-bottom radio-null"
value=""
<?= $selected_dates[$range_index] == null
<?= empty($selected_rooms[$range_index])
? 'checked="checked"'
: '' ?>>
</td>
......@@ -287,7 +287,7 @@
<input type="radio" name="<?= htmlReady($room_radio_name) ?>"
class="radio-null text-bottom"
value=""
<?= $selected_dates[$range_index] == null
<?= empty($selected_rooms[$range_index]) && empty($interval['booked_room'])
? 'checked="checked"'
: '' ?>>
</td>
......@@ -304,7 +304,7 @@
'time_intervals' => $request_time_intervals,
'availability' => $room_availability[$request_resource->id],
'underload' => $room_underload[$room_request->resource_id],
'selected_dates' => $selected_rooms
'selected_rooms' => $selected_rooms
]
) ?>
<? endif ?>
......@@ -317,7 +317,7 @@
'time_intervals' => $request_time_intervals,
'availability' => $this->room_availability[$room->id],
'underload' => $room_underload[$room->id],
'selected_dates' => $selected_rooms
'selected_rooms' => $selected_rooms
]
) ?>
<? endforeach ?>
......
......@@ -56,7 +56,7 @@
class="text-bottom radio-<?= htmlReady($room->id) ?>"
value="<?= htmlReady($room->id) ?>"
<?= $availability <= 0.0 ? 'disabled="disabled"' : '' ?>
<?= ($availability > 0 && $selected_dates[$range_index] == $room->id)
<?= ($availability > 0 && $selected_rooms[$range_index] == $room->id)
? 'checked="checked"'
: ''?>>
<? if ($availability >= 1.0) : ?>
......@@ -97,7 +97,7 @@
<input type="radio" name="<?= htmlReady($room_radio_name) ?>"
class="text-bottom radio-<?= htmlReady($room->id) ?>"
value="<?= htmlReady($room->id) ?>"
<?= ($selected_dates[$range_index] == $room->id
<?= ($selected_rooms[$range_index] == $room->id
|| $interval['booked_room'] == $room->id)
? 'checked="checked"'
: ''?>>
......
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