diff --git a/app/controllers/resources/room.php b/app/controllers/resources/room.php index b3a77a1a4f6beeb4b2746eb04e46944d7cf655bc..a5448c06a319f924ca29cb7a523e6eb276f70c55 100644 --- a/app/controllers/resources/room.php +++ b/app/controllers/resources/room.php @@ -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; } diff --git a/app/views/resources/room/_add_edit_form.php b/app/views/resources/room/_add_edit_form.php index 320996ccc26a1c6ea2e108b57b2f658d140d7ea3..77e456997255dc8915a2aa38c91f058fbda83e56 100644 --- a/app/views/resources/room/_add_edit_form.php +++ b/app/views/resources/room/_add_edit_form.php @@ -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 ?? '') ?>"> diff --git a/db/migrations/6.0.12_tic_2715.php b/db/migrations/6.0.12_tic_2715.php new file mode 100644 index 0000000000000000000000000000000000000000..f6cfa597dc575c05aef9069b6e3a7f41f22a17ee --- /dev/null +++ b/db/migrations/6.0.12_tic_2715.php @@ -0,0 +1,21 @@ +<?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); + } +} diff --git a/lib/models/resources/Resource.php b/lib/models/resources/Resource.php index 32fce2b59261d83bc8af6c48d551646e4383592b..7c870d93262d9de0bbb3cf3a6daa57b072300a06 100644 --- a/lib/models/resources/Resource.php +++ b/lib/models/resources/Resource.php @@ -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;