diff --git a/lib/models/ConsultationBooking.php b/lib/models/ConsultationBooking.php index 7782681fa45797208533089a43e2fedbfc9f94f7..17cb236f50c29d2534d1f4e51ac2ce361c46f4a2 100644 --- a/lib/models/ConsultationBooking.php +++ b/lib/models/ConsultationBooking.php @@ -47,7 +47,7 @@ class ConsultationBooking extends SimpleORMap implements PrivacyObject $config['registered_callbacks']['before_create'][] = function (ConsultationBooking $booking) { setTempLanguage($booking->user_id); - $event = $booking->slot->createEvent($booking->user); + $event = $booking->slot->createEvent($booking->user, 'booking'); $event->category = 1; $event->title = sprintf( _('Termin bei %s'), diff --git a/lib/models/ConsultationSlot.php b/lib/models/ConsultationSlot.php index 520b91e10218f9a1ad4318a4116492bc2f652705..e078914c61eff9446c6dd48f7d144954379f072e 100644 --- a/lib/models/ConsultationSlot.php +++ b/lib/models/ConsultationSlot.php @@ -214,12 +214,13 @@ class ConsultationSlot extends SimpleORMap * Creates a Stud.IP calendar event relating to the slot. * * @param User $user User object to create the event for + * @param string $type Create an event for which type (slot or booking) * @return CalendarDate Created event */ - public function createEvent(User $user) : CalendarDate + public function createEvent(User $user, string $type = 'slot') : CalendarDate { $event = new CalendarDate(); - $event->unique_id = $this->createEventId($user); + $event->unique_id = $this->createEventId($user, $type); $event->author_id = $user->id; $event->editor_id = $user->id; $event->begin = $this->start_time; @@ -244,12 +245,11 @@ class ConsultationSlot extends SimpleORMap /** * Returns a unique event id. * - * @param User $user [description] * @return string unique event id */ - protected function createEventId(User $user): string + protected function createEventId(User $user, string $type): string { - return self::EVENT_PREFIX . "{$this->id}:{$user->id}"; + return self::EVENT_PREFIX . "{$this->id}:{$user->id}:{$type}"; } /**