Skip to content

Commit

Permalink
Merge pull request #2004 from phili67/phili67-recurrence-id-bug-res
Browse files Browse the repository at this point in the history
Phili67 recurrence id bug res
  • Loading branch information
phili67 authored Jan 16, 2022
2 parents 153299a + 6b91581 commit 28b8e52
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ public function manageEvent(ServerRequestInterface $request, ResponseInterface $

return $response->withJson( $calendarService->modifyEventFromCalendar($input->calendarID, $input->eventID, $input->reccurenceID, $input->start,
$input->end, $input->EventTitle, $input->EventDesc, $input->location, $input->addGroupAttendees, $input->alarm, $input->eventTypeID, $input->eventNotes,
$input->eventInActive, $input->Fields, $input->EventCountNotes, $input->endrecurrence) );
$input->eventInActive, $input->Fields, $input->EventCountNotes, $input->recurrenceValid, $input->recurrenceType, $input->endrecurrence) );
}

return $response->withJson(["status" => "failed"]);
Expand Down
32 changes: 21 additions & 11 deletions src/EcclesiaCRM/Service/CalendarService.php
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ public function removeEventFromCalendar($calendarID, $eventID, $reccurenceID = n

public function modifyEventFromCalendar($calendarID, $eventID, $reccurenceID, $start, $end, $EventTitle,
$EventDesc, $location, $addGroupAttendees, $alarm, $eventTypeID,
$eventNotes, $eventInActive, $Fields, $EventCountNotes, $endrecurrence)
$eventNotes, $eventInActive, $Fields, $EventCountNotes, $recurrenceValid, $recurrenceType, $endrecurrence)
{
$old_event = EventQuery::Create()->findOneById($eventID);

Expand All @@ -599,9 +599,7 @@ public function modifyEventFromCalendar($calendarID, $eventID, $reccurenceID, $s
$freqEventsCount = count($eventFullInfos['freqEvents']);
}

$calendarService = new CalendarService();

if (isset($reccurenceID) && $reccurenceID != '') {// we're in a recursive event
if ( isset($reccurenceID) && $reccurenceID != '' ) {// we're in a recursive event

try {
// we have to delete the old event from the reccurence event
Expand All @@ -616,7 +614,7 @@ public function modifyEventFromCalendar($calendarID, $eventID, $reccurenceID, $s
$calendarBackend->updateCalendarObject($oldCalendarID, $event['uri'], $vcalendar->serialize());

// now we add the new event
$calendarService->createEventForCalendar(
$this->createEventForCalendar(
$calendarID, $start, $end,
"", "", $EventDesc, $EventTitle, $location,
false, $addGroupAttendees, $alarm, $eventTypeID, $eventNotes,
Expand All @@ -626,11 +624,12 @@ public function modifyEventFromCalendar($calendarID, $eventID, $reccurenceID, $s
return ["status" => "success"];
} else {
$calendarBackend->deleteCalendarObject($oldCalendarID, $event['uri']);

// now we add the new event
$calendarService->createEventForCalendar(
$this->createEventForCalendar(
$calendarID, $start, $end,
"", "", $EventDesc, $EventTitle, $location,
false, $addGroupAttendees, $alarm, $eventTypeID, $eventNotes,
$recurrenceType, $endrecurrence, $EventDesc, $EventTitle, $location,
$recurrenceValid, $addGroupAttendees, $alarm, $eventTypeID, $eventNotes,
$eventInActive, $Fields, $EventCountNotes
);
return ["status" => "success"];
Expand All @@ -642,18 +641,29 @@ public function modifyEventFromCalendar($calendarID, $eventID, $reccurenceID, $s
$calendarBackend->updateCalendarObject($oldCalendarID, $event['uri'], $vcalendar->serialize());

// now we add the new event
$calendarService->createEventForCalendar(
$this->createEventForCalendar(
$calendarID, $start, $end,
"", "", $EventDesc, $EventTitle, $location,
false, $addGroupAttendees, $alarm, $eventTypeID, $eventNotes,
$eventInActive, $Fields, $EventCountNotes
);
}
} /*else {
} else {
// We have to use the sabre way to ensure the event is reflected in external connection : CalDav
$calendarBackend->deleteCalendarObject($oldCalendarID, $event['uri']);
}*/

// now we add the new event
$this->createEventForCalendar(
$calendarID, $start, $end,
$recurrenceType, $endrecurrence, $EventDesc, $EventTitle, $location,
$recurrenceValid, $addGroupAttendees, $alarm, $eventTypeID, $eventNotes,
$eventInActive, $Fields, $EventCountNotes
);

return ["status" => "success"];
}

// this code is normally dead !!!!

// Now we start to work with the new calendar
if (is_array($calendarID)) {
Expand Down

0 comments on commit 28b8e52

Please sign in to comment.