mirror of
https://github.com/alextselegidis/easyappointments.git
synced 2024-11-10 10:02:33 +03:00
More fixes related to the caldav syncing (#209)
This commit is contained in:
parent
2aea423b38
commit
ab8257f366
3 changed files with 8 additions and 5 deletions
|
@ -70,7 +70,8 @@ class Caldav_sync
|
||||||
|
|
||||||
$caldav_calendar = $provider['settings']['caldav_calendar'];
|
$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);
|
$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_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);
|
$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
|
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' : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -78,7 +78,7 @@ class Ics_file
|
||||||
->setEnd($appointment_end)
|
->setEnd($appointment_end)
|
||||||
->setStatus('CONFIRMED')
|
->setStatus('CONFIRMED')
|
||||||
->setSummary($service['name'])
|
->setSummary($service['name'])
|
||||||
->setUid($this->generate_uid($appointment['id']));
|
->setUid($appointment['id_caldav_calendar'] ?: $this->generate_uid($appointment['id']));
|
||||||
|
|
||||||
if (!empty($service['location'])) {
|
if (!empty($service['location'])) {
|
||||||
$location = new Location();
|
$location = new Location();
|
||||||
|
@ -198,7 +198,7 @@ class Ics_file
|
||||||
->setEnd($unavailability_end)
|
->setEnd($unavailability_end)
|
||||||
->setStatus('CONFIRMED')
|
->setStatus('CONFIRMED')
|
||||||
->setSummary('Unavailability')
|
->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']));
|
$event->setDescription(str_replace("\n", "\\n", (string) $unavailability['notes']));
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,7 @@ class Synchronization
|
||||||
$this->CI->load->model('appointments_model');
|
$this->CI->load->model('appointments_model');
|
||||||
|
|
||||||
$this->CI->load->library('google_sync');
|
$this->CI->load->library('google_sync');
|
||||||
|
$this->CI->load->library('caldav_sync');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue