| @@ -46,19 +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 | { |
| 55 | - $status = $booking->status; | |
| 57 | + $status = $status ?: $booking->status; | |
| 56 | 58 | |
| 57 | 59 | $maps = [ |
| 58 | - 'scheduled' => 'after_booking_scheduled', | |
| 59 | - 'cancelled' => 'booking_schedule_cancelled', | |
| 60 | - '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', | |
| 61 | 66 | ]; |
| 62 | 67 | |
| 63 | 68 | if (!isset($maps[$status])) { |
| 64 | 69 | return false; |
| @@ -89,9 +94,8 @@ | ||
| 89 | 94 | } |
| 90 | 95 | |
| 91 | 96 | // Now we have to filter the feeds which are enabled |
| 92 | 97 | $enabledFeeds = $this->globalNotificationService->getEnabledFeeds($feeds, $booking); |
| 93 | - | |
| 94 | 98 | if (!$enabledFeeds) { |
| 95 | 99 | return false; |
| 96 | 100 | } |
| 97 | 101 | |
| @@ -121,6 +125,11 @@ | ||
| 121 | 125 | } |
| 122 | 126 | } |
| 123 | 127 | |
| 124 | 128 | return true; |
| 129 | + } | |
| 130 | + | |
| 131 | + public function checkGlobalIntegration($booking, $oldBooking, $calendarEvent) | |
| 132 | + { | |
| 133 | + return $this->maybeHandleGlobalIntegration($booking, $calendarEvent, 'rescheduled'); | |
| 125 | 134 | } |
| 126 | 135 | } |