aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorJan-Hendrik Willms <tleilax+studip@gmail.com>2024-08-09 06:26:03 +0000
committerJan-Hendrik Willms <tleilax+studip@gmail.com>2024-08-09 06:26:03 +0000
commitadc3d45aafee13213287b0a3da2e41c6d09b15db (patch)
treed1dddc2d67e02e0698eb3bb80b7657dc25d1484a /app
parent7c7fc4b361fd583a834695e43b80c97a84fee656 (diff)
refine creation of single consultation dates, re #1871
Merge request studip/studip!3257
Diffstat (limited to 'app')
-rw-r--r--app/controllers/consultation/admin.php14
-rw-r--r--app/views/consultation/admin/edit.php2
2 files changed, 11 insertions, 5 deletions
diff --git a/app/controllers/consultation/admin.php b/app/controllers/consultation/admin.php
index 8699349..21507ed 100644
--- a/app/controllers/consultation/admin.php
+++ b/app/controllers/consultation/admin.php
@@ -199,22 +199,27 @@ class Consultation_AdminController extends ConsultationController
try {
$interval = Request::int('interval');
$start = $this->getDateAndTime('start');
- $end = $this->getDateAndTime($interval === 0 ? 'start' : 'end', 'end');
+ $end = $this->getDateAndTime($interval <= 0 ? 'start' : 'end', 'end');
if (date('Hi', $end) <= date('Hi', $start)) {
throw new InvalidArgumentException(_('Die Endzeit liegt vor der Startzeit!'));
}
$dow = Request::int('day-of-week');
- if ($interval === 0) {
+ if ($interval <= 0) {
$dow = date('w', $start);
}
// Determine duration of a slot and pause times
$duration = Request::int('duration');
+
+ if ($duration === null && $interval === -1) {
+ $duration = (int) (($end - $start) / 60);
+ }
+
$pause_time = Request::bool('pause') ? Request::int('pause_time') : null;
$pause_duration = Request::bool('pause') ? Request::int('pause_duration') : null;
- if ($pause_time && $pause_time < $duration) {
+ if ($interval >= 0 && $pause_time && $pause_time < $duration) {
throw new InvalidArgumentException(_('Die definierte Zeit bis zur Pause ist kleiner als die Dauer eines Termins.'));
}
@@ -231,6 +236,7 @@ class Consultation_AdminController extends ConsultationController
$pause_time,
$pause_duration
);
+
if ($slot_count >= self::SLOT_COUNT_THRESHOLD && !Request::int('confirmed')) {
$this->flash['confirm-many'] = $slot_count;
throw new Exception('', -1);
@@ -257,7 +263,7 @@ class Consultation_AdminController extends ConsultationController
$block->lock_time = Request::int('lock_time');
$block->consecutive = Request::bool('consecutive', false);
- $slots = $block->createSlots(Request::int('duration'), $pause_time, $pause_duration);
+ $slots = $block->createSlots($duration, $pause_time, $pause_duration);
if (count($slots) === 0) {
continue;
}
diff --git a/app/views/consultation/admin/edit.php b/app/views/consultation/admin/edit.php
index f9b416a..1fd0cf1 100644
--- a/app/views/consultation/admin/edit.php
+++ b/app/views/consultation/admin/edit.php
@@ -45,7 +45,7 @@
<? endif; ?>
<label>
- <?= _('Maximale Teilnehmerzahl') ?>
+ <?= _('Maximale Teilnehmendenzahl') ?>
<?= tooltipIcon(_('Falls Sie mehrere Personen zulassen wollen (wie z.B. zu einer Klausureinsicht), so geben Sie hier die maximale Anzahl an Personen an, die sich anmelden dürfen.')) ?>
<input required type="text" name="size" id="size"
min="1" max="50" value="<?= $block->size ?>">