Skip to content
Snippets Groups Projects
Commit a629426a authored by Elmar Ludwig's avatar Elmar Ludwig Committed by David Siegfried
Browse files

add column to mark resources as requestable via the booking plan, fixes #2715

Closes #2715

Merge request studip/studip!2172
parent 1d8dfc51
No related branches found
No related tags found
No related merge requests found
......@@ -293,6 +293,7 @@ class Resources_RoomController extends AuthenticatedController
$this->room_type = Request::get('room_type');
$this->seats = Request::int('seats');
$this->booking_plan_is_public = Request::get('booking_plan_is_public');
$this->booking_plan_request = Request::int('booking_plan_request', 0);
$this->sort_position = Request::get('sort_position');
$this->property_data = Request::getArray('properties');
......@@ -365,6 +366,7 @@ class Resources_RoomController extends AuthenticatedController
$this->room->description = $this->description;
$this->room->requestable = strval($this->requestable);
$this->room->lockable = $this->lockable;
$this->room->booking_plan_request = $this->booking_plan_request;
if ($GLOBALS['perm']->have_perm('root')) {
$this->room->sort_position = $this->sort_position;
}
......
......@@ -37,6 +37,11 @@
<?= $room->lockable ? 'checked' : '' ?>>
<?= _('Globale Buchungssperren gelten für diesen Raum') ?>
</label>
<label>
<input type="checkbox" name="booking_plan_request" value="1"
<?= $room->booking_plan_request ? 'checked' : '' ?>>
<?= _('Raumanfragen über den Belegungsplan möglich') ?>
</label>
<label>
<?= _('Raumtyp') ?>
<input type="text" name="room_type" value="<?= htmlReady($room_type ?? '') ?>">
......
<?php
class Tic2715 extends Migration
{
public function description ()
{
return 'Add a column to mark resources as requestable via the booking plan, default is 1';
}
public function up()
{
$query = 'ALTER TABLE `resources`
ADD `booking_plan_request` TINYINT(1) UNSIGNED NOT NULL DEFAULT 1 AFTER `lockable`';
DBManager::get()->exec($query);
}
public function down()
{
$query = 'ALTER TABLE `resources` DROP `booking_plan_request`';
DBManager::get()->exec($query);
}
}
......@@ -2479,7 +2479,7 @@ class Resource extends SimpleORMap implements StudipItem
*/
public function userHasRequestRights(User $user)
{
if (!Config::get()->RESOURCES_ALLOW_ROOM_REQUESTS) {
if (!Config::get()->RESOURCES_ALLOW_ROOM_REQUESTS || !$this->booking_plan_request) {
return false;
}
$min_perm = Config::get()->RESOURCES_MIN_REQUEST_PERMISSION;
......
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