Skip to content
Snippets Groups Projects
Commit 6581c801 authored by Moritz Strohm's avatar Moritz Strohm
Browse files

SingleCalendar::deleteEventWithConsultation: removed unnecessary check, added...

SingleCalendar::deleteEventWithConsultation: removed unnecessary check, added check for other users connected to the event
parent 4eca8891
Branches
No related tags found
No related merge requests found
......@@ -579,15 +579,15 @@ class SingleCalendar
if ($consultation_event) {
//Check if the slot is empty and delete it, if so.
if ($consultation_event->slot) {
if (!empty($consultation_event->slot->bookings)) {
if (empty($consultation_event->slot->events)) {
foreach ($consultation_event->slot->bookings as $booking) {
if ($booking->isDeleted()) {
continue;
}
$booking->cancel();
}
$consultation_event->slot->delete();
return true;
return $consultation_event->slot->delete();
} else {
//There are other users who are connected to the slot.
//Delete only the event for the user.
return $consultation_event->delete();
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment