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 ...@@ -1186,10 +1186,7 @@ class Resources_RoomRequestController extends AuthenticatedController
$room, $room,
[$interval] [$interval]
); );
if ($interval_available[0]) { if (!$interval_available[0]) {
$range_index = $interval['range'] . '_' . $interval['range_id'];
$this->selected_rooms[$range_index] = $room->id;
} else {
$this->unavailable_dates[$room->id]++; $this->unavailable_dates[$room->id]++;
$this->unavailable_metadate_dates[$room->id][$metadate_id]++; $this->unavailable_metadate_dates[$room->id][$metadate_id]++;
} }
...@@ -1397,7 +1394,7 @@ class Resources_RoomRequestController extends AuthenticatedController ...@@ -1397,7 +1394,7 @@ class Resources_RoomRequestController extends AuthenticatedController
} }
$this->alternatives_selection = 'room_search'; $this->alternatives_selection = 'room_search';
if (Request::submitted('select_alternatives')) { if (Request::get('alternatives_selection')) {
CSRFProtection::verifyUnsafeRequest(); CSRFProtection::verifyUnsafeRequest();
$this->selected_rooms = Request::getArray('selected_rooms'); $this->selected_rooms = Request::getArray('selected_rooms');
$this->alternatives_selection = Request::get('alternatives_selection'); $this->alternatives_selection = Request::get('alternatives_selection');
......
...@@ -272,7 +272,7 @@ ...@@ -272,7 +272,7 @@
<input type="radio" name="<?= htmlReady($room_radio_name) ?>" <input type="radio" name="<?= htmlReady($room_radio_name) ?>"
class="text-bottom radio-null" class="text-bottom radio-null"
value="" value=""
<?= $selected_dates[$range_index] == null <?= empty($selected_rooms[$range_index])
? 'checked="checked"' ? 'checked="checked"'
: '' ?>> : '' ?>>
</td> </td>
...@@ -287,7 +287,7 @@ ...@@ -287,7 +287,7 @@
<input type="radio" name="<?= htmlReady($room_radio_name) ?>" <input type="radio" name="<?= htmlReady($room_radio_name) ?>"
class="radio-null text-bottom" class="radio-null text-bottom"
value="" value=""
<?= $selected_dates[$range_index] == null <?= empty($selected_rooms[$range_index]) && empty($interval['booked_room'])
? 'checked="checked"' ? 'checked="checked"'
: '' ?>> : '' ?>>
</td> </td>
...@@ -304,7 +304,7 @@ ...@@ -304,7 +304,7 @@
'time_intervals' => $request_time_intervals, 'time_intervals' => $request_time_intervals,
'availability' => $room_availability[$request_resource->id], 'availability' => $room_availability[$request_resource->id],
'underload' => $room_underload[$room_request->resource_id], 'underload' => $room_underload[$room_request->resource_id],
'selected_dates' => $selected_rooms 'selected_rooms' => $selected_rooms
] ]
) ?> ) ?>
<? endif ?> <? endif ?>
...@@ -317,7 +317,7 @@ ...@@ -317,7 +317,7 @@
'time_intervals' => $request_time_intervals, 'time_intervals' => $request_time_intervals,
'availability' => $this->room_availability[$room->id], 'availability' => $this->room_availability[$room->id],
'underload' => $room_underload[$room->id], 'underload' => $room_underload[$room->id],
'selected_dates' => $selected_rooms 'selected_rooms' => $selected_rooms
] ]
) ?> ) ?>
<? endforeach ?> <? endforeach ?>
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
class="text-bottom radio-<?= htmlReady($room->id) ?>" class="text-bottom radio-<?= htmlReady($room->id) ?>"
value="<?= htmlReady($room->id) ?>" value="<?= htmlReady($room->id) ?>"
<?= $availability <= 0.0 ? 'disabled="disabled"' : '' ?> <?= $availability <= 0.0 ? 'disabled="disabled"' : '' ?>
<?= ($availability > 0 && $selected_dates[$range_index] == $room->id) <?= ($availability > 0 && $selected_rooms[$range_index] == $room->id)
? 'checked="checked"' ? 'checked="checked"'
: ''?>> : ''?>>
<? if ($availability >= 1.0) : ?> <? if ($availability >= 1.0) : ?>
...@@ -97,7 +97,7 @@ ...@@ -97,7 +97,7 @@
<input type="radio" name="<?= htmlReady($room_radio_name) ?>" <input type="radio" name="<?= htmlReady($room_radio_name) ?>"
class="text-bottom radio-<?= htmlReady($room->id) ?>" class="text-bottom radio-<?= htmlReady($room->id) ?>"
value="<?= htmlReady($room->id) ?>" value="<?= htmlReady($room->id) ?>"
<?= ($selected_dates[$range_index] == $room->id <?= ($selected_rooms[$range_index] == $room->id
|| $interval['booked_room'] == $room->id) || $interval['booked_room'] == $room->id)
? 'checked="checked"' ? 'checked="checked"'
: ''?>> : ''?>>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment