aboutsummaryrefslogtreecommitdiff
path: root/app/controllers/consultation/admin.php
diff options
context:
space:
mode:
authorJan-Hendrik Willms <tleilax+studip@gmail.com>2024-07-08 17:50:06 +0000
committerJan-Hendrik Willms <tleilax+studip@gmail.com>2024-07-08 17:50:06 +0000
commit17b24ac5da280a20368942a3f933130d97ec2554 (patch)
tree4dbac72bea6fee20eab0ccaa233dcd6861d7a182 /app/controllers/consultation/admin.php
parenta93297b77d0782914552d5241cbd32df92597ada (diff)
split display and booking action into two separate actions, fixes #3771
Closes #3771 Merge request studip/studip!3180
Diffstat (limited to 'app/controllers/consultation/admin.php')
-rw-r--r--app/controllers/consultation/admin.php29
1 files changed, 16 insertions, 13 deletions
diff --git a/app/controllers/consultation/admin.php b/app/controllers/consultation/admin.php
index a1f16c5..1a83124 100644
--- a/app/controllers/consultation/admin.php
+++ b/app/controllers/consultation/admin.php
@@ -394,24 +394,27 @@ class Consultation_AdminController extends ConsultationController
'sem_perm' => $permissions,
]);
}
+ }
- if (Request::isPost()) {
- CSRFProtection::verifyUnsafeRequest();
+ public function store_booking_action($block_id, $slot_id, $page = 0): void
+ {
+ CSRFProtection::verifyUnsafeRequest();
- if ($this->slot->isOccupied()) {
- PageLayout::postError(_('Dieser Termin ist bereits belegt.'));
- } else {
- $booking = new ConsultationBooking();
- $booking->slot_id = $this->slot->id;
- $booking->user_id = Request::option('user_id');
- $booking->reason = trim(Request::get('reason'));
- $booking->store();
+ $slot = $this->loadSlot($block_id, $slot_id);
- PageLayout::postSuccess(_('Der Termin wurde reserviert.'));
- }
+ if ($slot->isOccupied()) {
+ PageLayout::postError(_('Dieser Termin ist bereits belegt.'));
+ } else {
+ $booking = new ConsultationBooking();
+ $booking->slot_id = $slot->id;
+ $booking->user_id = Request::option('user_id');
+ $booking->reason = trim(Request::get('reason'));
+ $booking->store();
- $this->redirect("consultation/admin/index/{$page}#slot-{$this->slot->id}");
+ PageLayout::postSuccess(_('Der Termin wurde reserviert.'));
}
+
+ $this->redirect("consultation/admin/index/{$page}#slot-{$slot->id}");
}
public function edit_action($block_id, $page = 0)