aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoritz Strohm <strohm@data-quest.de>2022-02-28 15:27:48 +0100
committerMoritz Strohm <strohm@data-quest.de>2022-02-28 15:27:48 +0100
commit5cd75100c6b5113ec84fa8ee5dabc88eb5d07e24 (patch)
tree57376f214795bfa9adf44722d86f0aa8595e0de0
parentcfb83c977d05866902f8e8e26f41582c255a7fc3 (diff)
attemted to prevent event creationg in ConsultationSlot::updateEventsbiest-00671-2
-rw-r--r--lib/models/ConsultationBooking.php2
-rw-r--r--lib/models/ConsultationSlot.php8
2 files changed, 8 insertions, 2 deletions
diff --git a/lib/models/ConsultationBooking.php b/lib/models/ConsultationBooking.php
index 3e02ba0..7a5e015 100644
--- a/lib/models/ConsultationBooking.php
+++ b/lib/models/ConsultationBooking.php
@@ -88,7 +88,7 @@ class ConsultationBooking extends SimpleORMap implements PrivacyObject
};
$config['registered_callbacks']['after_delete'][] = function (ConsultationBooking $booking) {
- $booking->slot->updateEvents();
+ $booking->slot->updateEvents(true);
};
parent::configure($config);
diff --git a/lib/models/ConsultationSlot.php b/lib/models/ConsultationSlot.php
index 1177fce..a271a75 100644
--- a/lib/models/ConsultationSlot.php
+++ b/lib/models/ConsultationSlot.php
@@ -190,8 +190,11 @@ class ConsultationSlot extends SimpleORMap
/**
* Updates the teacher event that belongs to the slot. This will either be
* set to be unoccupied, occupied by only one user or by a group of user.
+ *
+ * @param bool $delete_action Whether this method is called from a delete action (true)
+ * or not (false). Defaults to false.
*/
- public function updateEvents()
+ public function updateEvents(bool $delete_action = false)
{
// If no range is associated, remove the event
if (!$this->block->range) {
@@ -219,6 +222,9 @@ class ConsultationSlot extends SimpleORMap
}
}
+ if ($delete_action) {
+ return;
+ }
// Add events for missing responsible users
$missing = array_diff($responsible_ids, $this->events->pluck('user_id'));
foreach ($missing as $user_id) {