← All changes
|
app/Http/Controllers/CalendarIntegrationController.php
+10
-2
2.4.0
→
2.5.0
View file →
| @@ -91,15 +91,23 @@ | ||
| 91 | 91 | $calendarEvent = CalendarSlot::where('calendar_id', $calendarId)->findOrFail($slotId); |
| 92 | 92 | |
| 93 | 93 | $fromEventId = intval($this->request->get('from_event_id')); |
| 94 | 94 | |
| 95 | - if (!$fromEventId || !PermissionManager::canUpdateCalendarEvent($fromEventId)) { | |
| 95 | + $fromEvent = CalendarSlot::find($fromEventId); | |
| 96 | + | |
| 97 | + if (!$fromEvent) { | |
| 96 | 98 | return $this->sendError([ |
| 99 | + 'message' => __('Source event not found', 'fluent-booking') | |
| 100 | + ], 422); | |
| 101 | + } | |
| 102 | + | |
| 103 | + if (!PermissionManager::canUpdateCalendarEvent($fromEvent->id)) { | |
| 104 | + return $this->sendError([ | |
| 97 | 105 | 'message' => __('You do not have permission to clone from the selected event.', 'fluent-booking') |
| 98 | 106 | ], 403); |
| 99 | 107 | } |
| 100 | 108 | |
| 101 | - $fromEventIntegrations = Meta::where('object_id', $fromEventId) | |
| 109 | + $fromEventIntegrations = Meta::where('object_id', $fromEvent->id) | |
| 102 | 110 | ->where('object_type', 'integration') |
| 103 | 111 | ->get(); |
| 104 | 112 | |
| 105 | 113 | if ($fromEventIntegrations->isEmpty()) { |