PluginProbe
Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution / 2.5.0
Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution v2.5.0
2.5.0 2.4.0 2.3.0 2.2.5 2.2.0 2.1.2 2.1.1 trunk 1.10.0 1.10.01 1.10.02 1.5.0 1.5.01 1.5.02 1.5.1 1.5.10 1.5.20 1.5.21 1.5.22 1.5.23 1.5.24 1.5.25 1.6.0 1.7.0 1.7.1 All 34 releases
← All changes | app/Hooks/Handlers/GlobalNotificationHandler.php +17 -9 1.5.1 → 2.5.0 View file →
@@ -46,20 +46,24 @@
46 46
47 47 add_action('fluent_booking/after_booking_scheduled', [$this, 'maybeHandleGlobalIntegration'], 10, 2);
48 48 add_action('fluent_booking/booking_schedule_cancelled', [$this, 'maybeHandleGlobalIntegration'], 10, 2);
49 49 add_action('fluent_booking/booking_schedule_completed', [$this, 'maybeHandleGlobalIntegration'], 10, 2);
50 -
50 + add_action('fluent_booking/booking_schedule_rejected', [$this, 'maybeHandleGlobalIntegration'], 10, 2);
51 + add_action('fluent_booking/booking_schedule_no_show', [$this, 'maybeHandleGlobalIntegration'], 10, 2);
52 + add_action('fluent_booking/after_booking_rescheduled', [$this, 'checkGlobalIntegration'], 10, 3);
51 53 }
52 54
53 - public function maybeHandleGlobalIntegration($booking, $calendarSlot)
55 + public function maybeHandleGlobalIntegration($booking, $calendarSlot, $status = null)
54 56 {
57 + $status = $status ?: $booking->status;
55 58
56 - $status = $booking->status;
57 -
58 59 $maps = [
59 - 'scheduled' => 'after_booking_scheduled',
60 - 'cancelled' => 'booking_schedule_cancelled',
61 - 'completed' => 'booking_schedule_completed'
60 + 'scheduled' => 'after_booking_scheduled',
61 + 'cancelled' => 'booking_schedule_cancelled',
62 + 'completed' => 'booking_schedule_completed',
63 + 'rescheduled' => 'after_booking_rescheduled',
64 + 'rejected' => 'booking_schedule_rejected',
65 + 'no_show' => 'booking_schedule_no_show',
62 66 ];
63 67
64 68 if (!isset($maps[$status])) {
65 69 return false;
@@ -90,9 +94,8 @@
90 94 }
91 95
92 96 // Now we have to filter the feeds which are enabled
93 97 $enabledFeeds = $this->globalNotificationService->getEnabledFeeds($feeds, $booking);
94 -
95 98 if (!$enabledFeeds) {
96 99 return false;
97 100 }
98 101
@@ -99,9 +102,9 @@
99 102 foreach ($enabledFeeds as $feed) {
100 103
101 104 $enabledTriggers = Arr::get($feed, 'settings.event_trigger', []);
102 105
103 - if (!$enabledTriggers && !in_array($targetHook, $enabledTriggers)) {
106 + if (!$enabledTriggers || !in_array($targetHook, $enabledTriggers)) {
104 107 continue;
105 108 }
106 109
107 110 // We will decide if this feed will run on async or sync
@@ -122,6 +125,11 @@
122 125 }
123 126 }
124 127
125 128 return true;
129 + }
130 +
131 + public function checkGlobalIntegration($booking, $oldBooking, $calendarEvent)
132 + {
133 + return $this->maybeHandleGlobalIntegration($booking, $calendarEvent, 'rescheduled');
126 134 }
127 135 }