More fixes related to the caldav syncing (#209)

This commit is contained in:
Alex Tselegidis 2024-05-12 18:07:46 +02:00
parent 2aea423b38
commit ab8257f366
3 changed files with 8 additions and 5 deletions

View File

@ -70,7 +70,8 @@ class Caldav_sync
$caldav_calendar = $provider['settings']['caldav_calendar'];
$caldav_event_id = $this->CI->ics_file->generate_uid($appointment['id']) . '.ics';
$caldav_event_id =
$appointment['id_caldav_calendar'] ?: $this->CI->ics_file->generate_uid($appointment['id']);
$uri = $this->get_caldav_event_uri($caldav_calendar, $caldav_event_id);
@ -107,7 +108,8 @@ class Caldav_sync
$caldav_calendar = $provider['settings']['caldav_calendar'];
$caldav_event_id = $this->CI->ics_file->generate_uid($unavailability['id']) . '.ics';
$caldav_event_id =
$unavailability['id_caldav_calendar'] ?: $this->CI->ics_file->generate_uid($unavailability['id']);
$uri = $this->get_caldav_event_uri($caldav_calendar, $caldav_event_id);
@ -420,7 +422,7 @@ class Caldav_sync
*/
private function get_caldav_event_uri(string $caldav_calendar, ?string $caldav_event_id = null): string
{
return trim($caldav_calendar, '/') . ($caldav_event_id ? '/' . $caldav_event_id : '');
return trim($caldav_calendar, '/') . ($caldav_event_id ? '/' . $caldav_event_id . '.ics' : '');
}
/**

View File

@ -78,7 +78,7 @@ class Ics_file
->setEnd($appointment_end)
->setStatus('CONFIRMED')
->setSummary($service['name'])
->setUid($this->generate_uid($appointment['id']));
->setUid($appointment['id_caldav_calendar'] ?: $this->generate_uid($appointment['id']));
if (!empty($service['location'])) {
$location = new Location();
@ -198,7 +198,7 @@ class Ics_file
->setEnd($unavailability_end)
->setStatus('CONFIRMED')
->setSummary('Unavailability')
->setUid($this->generate_uid($unavailability['id']));
->setUid($unavailability['id_caldav_calendar'] ?: $this->generate_uid($unavailability['id']));
$event->setDescription(str_replace("\n", "\\n", (string) $unavailability['notes']));

View File

@ -36,6 +36,7 @@ class Synchronization
$this->CI->load->model('appointments_model');
$this->CI->load->library('google_sync');
$this->CI->load->library('caldav_sync');
}
/**