aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/controllers/resources/room_request.php14
-rw-r--r--app/views/resources/room_request/_add_edit_form.php22
-rw-r--r--app/views/resources/room_request/resolve.php4
-rw-r--r--db/migrations/6.1.15.1_add_booking_text_to_resource_requests.php28
-rw-r--r--lib/models/resources/BrokenResource.php3
-rw-r--r--lib/models/resources/Building.php3
-rw-r--r--lib/models/resources/Location.php3
-rw-r--r--lib/models/resources/Resource.php11
-rw-r--r--lib/models/resources/ResourceLabel.php3
-rw-r--r--lib/models/resources/ResourceRequest.php3
10 files changed, 82 insertions, 12 deletions
diff --git a/app/controllers/resources/room_request.php b/app/controllers/resources/room_request.php
index 07af488..e74995a 100644
--- a/app/controllers/resources/room_request.php
+++ b/app/controllers/resources/room_request.php
@@ -668,6 +668,7 @@ class Resources_RoomRequestController extends AuthenticatedController
$this->subsequent_time = 0;
$this->max_preparation_time = $config->RESOURCES_MAX_PREPARATION_TIME;
$this->comment = '';
+ $this->booking_text = '';
$this->show_form = true;
@@ -718,7 +719,8 @@ class Resources_RoomRequestController extends AuthenticatedController
}
//Comment is optional.
- $this->comment = Request::get('comment');
+ $this->comment = Request::get('comment');
+ $this->booking_text = Request::get('booking_text');
//Convert the date and time strings to DateTime objects:
@@ -758,7 +760,8 @@ class Resources_RoomRequestController extends AuthenticatedController
$new_end,
$this->comment,
$this->preparation_time * 60,
- $this->subsequent_time * 60
+ $this->subsequent_time * 60,
+ $this->booking_text
);
if ($request) {
@@ -885,6 +888,7 @@ class Resources_RoomRequestController extends AuthenticatedController
$this->subsequent_time = $this->request->subsequent_time / 60;
$this->max_preparation_time = $config->RESOURCES_MAX_PREPARATION_TIME;
$this->comment = $this->request->comment;
+ $this->booking_text = $this->request->booking_text;
$this->show_form = true;
@@ -935,7 +939,8 @@ class Resources_RoomRequestController extends AuthenticatedController
}
//Comment is optional.
- $this->comment = Request::get('comment');
+ $this->comment = Request::get('comment');
+ $this->booking_text = Request::get('booking_text');
//Convert the date and time strings to DateTime objects:
@@ -970,6 +975,7 @@ class Resources_RoomRequestController extends AuthenticatedController
$this->request->begin = $new_begin->getTimestamp();
$this->request->end = $new_end->getTimestamp();
$this->request->comment = $this->comment;
+ $this->request->booking_text = $this->booking_text;
$this->request->preparation_time = $this->preparation_time * 60;
$this->request->subsequent_time = $this->subsequent_time * 60;
@@ -1657,7 +1663,7 @@ class Resources_RoomRequestController extends AuthenticatedController
0,
null,
$this->request->preparation_time,
- '',
+ $this->request->booking_text ?? '',
'',
ResourceBooking::TYPE_NORMAL,
false,
diff --git a/app/views/resources/room_request/_add_edit_form.php b/app/views/resources/room_request/_add_edit_form.php
index c9fef86..c256e02 100644
--- a/app/views/resources/room_request/_add_edit_form.php
+++ b/app/views/resources/room_request/_add_edit_form.php
@@ -1,3 +1,21 @@
+<?php
+/**
+ * @var bool $show_form
+ * @var string $form_action_link
+ * @var string $origin_url
+ * @var string $begin_date_str
+ * @var string $end_date_str
+ * @var string $begin_time_str
+ * @var string $end_time_str
+ * @var int $preparation_time
+ * @var int $max_preparation_time
+ * @var int $subsequent_time
+ * @var string $comment
+ * @var string $booking_text
+ * @var ResourceRequest $request
+ * @var Resources_RoomRequestController $controller
+ */
+?>
<? if ($show_form): ?>
<form class="default" method="post" action="<?= $form_action_link ?>" data-dialog="reload-on-close">
<input type="hidden" name="origin_url" value="<?= htmlReady($origin_url ?? '') ?>">
@@ -46,6 +64,10 @@
<?= _('Interner Kommentar') ?>
<textarea name="comment"><?= htmlReady($comment) ?></textarea>
</label>
+ <label>
+ <?= _('Buchungstext') ?>
+ <textarea name="booking_text"><?= htmlReady($booking_text) ?></textarea>
+ </label>
<footer data-dialog-button>
<?= \Studip\Button::create(_('Speichern'), 'save') ?>
<? if ($request): ?>
diff --git a/app/views/resources/room_request/resolve.php b/app/views/resources/room_request/resolve.php
index 7c518fb..a6c9ec6 100644
--- a/app/views/resources/room_request/resolve.php
+++ b/app/views/resources/room_request/resolve.php
@@ -169,6 +169,10 @@
<?= htmlReady($request->resource->name) ?>
</dd>
<? endif ?>
+ <? if ($request->booking_text) : ?>
+ <dt><?= _('Buchungstext') ?></dt>
+ <dd><?= htmlReady($request->booking_text) ?></dd>
+ <? endif ?>
<? if ($request->comment) : ?>
<dt><?= _('Interner Kommentar') ?></dt>
<dd><?= htmlReady($request->comment) ?></dd>
diff --git a/db/migrations/6.1.15.1_add_booking_text_to_resource_requests.php b/db/migrations/6.1.15.1_add_booking_text_to_resource_requests.php
new file mode 100644
index 0000000..72a55a3
--- /dev/null
+++ b/db/migrations/6.1.15.1_add_booking_text_to_resource_requests.php
@@ -0,0 +1,28 @@
+<?php
+
+
+class AddBookingTextToResourceRequests extends Migration
+{
+ public function description()
+ {
+ return 'Adds the booking_text field to resource requests.';
+ }
+
+ protected function up()
+ {
+ $db = DBManager::get();
+ $db->exec(
+ "ALTER TABLE `resource_requests`
+ ADD COLUMN booking_text TEXT"
+ );
+ }
+
+ protected function down()
+ {
+ $db = DBManager::get();
+ $db->exec(
+ "ALTER TABLE `resource_requests`
+ DROP COLUMN booking_text"
+ );
+ }
+}
diff --git a/lib/models/resources/BrokenResource.php b/lib/models/resources/BrokenResource.php
index 324851f..fdb7d71 100644
--- a/lib/models/resources/BrokenResource.php
+++ b/lib/models/resources/BrokenResource.php
@@ -121,7 +121,8 @@ class BrokenResource extends Resource
DateTime $end,
$comment = '',
$preparation_time = 0,
- $subsequent_time = 0
+ $subsequent_time = 0,
+ $booking_text = ''
)
{
return null;
diff --git a/lib/models/resources/Building.php b/lib/models/resources/Building.php
index 1c571ed..eafd6eb 100644
--- a/lib/models/resources/Building.php
+++ b/lib/models/resources/Building.php
@@ -475,7 +475,8 @@ class Building extends Resource
DateTime $end,
$comment = '',
$preparation_time = 0,
- $subsequent_time = 0
+ $subsequent_time = 0,
+ $booking_text = ''
)
{
return null;
diff --git a/lib/models/resources/Location.php b/lib/models/resources/Location.php
index 75c6c12..3783ef2 100644
--- a/lib/models/resources/Location.php
+++ b/lib/models/resources/Location.php
@@ -396,7 +396,8 @@ class Location extends Resource
DateTime $end,
$comment = '',
$preparation_time = 0,
- $subsequent_time = 0
+ $subsequent_time = 0,
+ $booking_text = ''
)
{
return null;
diff --git a/lib/models/resources/Resource.php b/lib/models/resources/Resource.php
index 2b71574..5906b9f 100644
--- a/lib/models/resources/Resource.php
+++ b/lib/models/resources/Resource.php
@@ -966,6 +966,9 @@ class Resource extends SimpleORMap implements StudipItem
* that is reserved for cleaning up or similar activities after the
* booking.
*
+ * @param string $booking_text The text that shall be displayed when the
+ * request has been turned into a booking.
+ *
* @return ResourceRequest A resource request object.
* @throws AccessDeniedException If the user is not permitted
* to request this resource.
@@ -984,7 +987,8 @@ class Resource extends SimpleORMap implements StudipItem
DateTime $end,
$comment = '',
$preparation_time = 0,
- $subsequent_time = 0
+ $subsequent_time = 0,
+ $booking_text = ''
)
{
//All users are permitted to create a request,
@@ -1031,8 +1035,9 @@ class Resource extends SimpleORMap implements StudipItem
? $subsequent_time
: 0;
- $request->closed = '0';
- $request->comment = $comment;
+ $request->closed = '0';
+ $request->comment = $comment;
+ $request->booking_text = $booking_text;
if (!$request->store()) {
throw new ResourceRequestException(
diff --git a/lib/models/resources/ResourceLabel.php b/lib/models/resources/ResourceLabel.php
index e55b3d1..246cab4 100644
--- a/lib/models/resources/ResourceLabel.php
+++ b/lib/models/resources/ResourceLabel.php
@@ -114,7 +114,8 @@ class ResourceLabel extends Resource
DateTime $end,
$comment = '',
$preparation_time = 0,
- $subsequent_time = 0
+ $subsequent_time = 0,
+ $booking_text = ''
)
{
return null;
diff --git a/lib/models/resources/ResourceRequest.php b/lib/models/resources/ResourceRequest.php
index 77ed732..7cdf18c 100644
--- a/lib/models/resources/ResourceRequest.php
+++ b/lib/models/resources/ResourceRequest.php
@@ -9,7 +9,7 @@
* the License, or (at your option) any later version.
*
* @author Moritz Strohm <strohm@data-quest.de>
- * @copyright 2017-2019
+ * @copyright 2017-2025
* @license http://www.gnu.org/licenses/gpl-2.0.html GPL version 2
* @category Stud.IP
* @package resources
@@ -29,6 +29,7 @@
* @property string|null $category_id database column
* @property string|null $comment database column
* @property string|null $reply_comment database column
+ * @property string|null $booking_text database column
* @property string $reply_recipients database column
* @property int $closed database column
* @property int|null $mkdate database column