diff options
author | Georg Ehrke <developer@georgehrke.com> | 2018-01-04 20:15:24 +0100 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2018-03-06 11:21:16 +0100 |
commit | 8b28e91dcbf2d37c8b00673b95bc5e0a6d921806 (patch) | |
tree | 1b14a5d0cc13a9fc087b10c611257ff84992ca65 /apps/dav | |
parent | ac8d57210229278f2e6e0ebb37392dd9237a92a9 (diff) | |
download | nextcloud-server-8b28e91dcbf2d37c8b00673b95bc5e0a6d921806.tar.gz nextcloud-server-8b28e91dcbf2d37c8b00673b95bc5e0a6d921806.zip |
generate different UIDs for Birthday, Anniversary and Death event
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
Diffstat (limited to 'apps/dav')
-rw-r--r-- | apps/dav/lib/CalDAV/BirthdayService.php | 7 | ||||
-rw-r--r-- | apps/dav/tests/unit/CardDAV/BirthdayServiceTest.php | 2 |
2 files changed, 5 insertions, 4 deletions
diff --git a/apps/dav/lib/CalDAV/BirthdayService.php b/apps/dav/lib/CalDAV/BirthdayService.php index 702b74bf1b3..55efa58163b 100644 --- a/apps/dav/lib/CalDAV/BirthdayService.php +++ b/apps/dav/lib/CalDAV/BirthdayService.php @@ -125,10 +125,11 @@ class BirthdayService { /** * @param string $cardData * @param string $dateField + * @param string $postfix * @param string $summarySymbol * @return null|VCalendar */ - public function buildDateFromContact($cardData, $dateField, $summarySymbol) { + public function buildDateFromContact($cardData, $dateField, $postfix, $summarySymbol) { if (empty($cardData)) { return null; } @@ -198,7 +199,7 @@ class BirthdayService { $date ); $vEvent->DTEND['VALUE'] = 'DATE'; - $vEvent->{'UID'} = $doc->UID; + $vEvent->{'UID'} = $doc->UID . $postfix; $vEvent->{'RRULE'} = 'FREQ=YEARLY'; $vEvent->{'SUMMARY'} = $summary; $vEvent->{'TRANSP'} = 'TRANSPARENT'; @@ -274,7 +275,7 @@ class BirthdayService { */ private function updateCalendar($cardUri, $cardData, $book, $calendarId, $type) { $objectUri = $book['uri'] . '-' . $cardUri . $type['postfix'] . '.ics'; - $calendarData = $this->buildDateFromContact($cardData, $type['field'], $type['symbol']); + $calendarData = $this->buildDateFromContact($cardData, $type['field'], $type['postfix'], $type['symbol']); $existing = $this->calDavBackEnd->getCalendarObject($calendarId, $objectUri); if (is_null($calendarData)) { if (!is_null($existing)) { diff --git a/apps/dav/tests/unit/CardDAV/BirthdayServiceTest.php b/apps/dav/tests/unit/CardDAV/BirthdayServiceTest.php index 72b3c57bea6..3d85a1a094f 100644 --- a/apps/dav/tests/unit/CardDAV/BirthdayServiceTest.php +++ b/apps/dav/tests/unit/CardDAV/BirthdayServiceTest.php @@ -59,7 +59,7 @@ class BirthdayServiceTest extends TestCase { * @param string | null $data */ public function testBuildBirthdayFromContact($expectedSummary, $data) { - $cal = $this->service->buildDateFromContact($data, 'BDAY', '*'); + $cal = $this->service->buildDateFromContact($data, 'BDAY', '', '*'); if ($expectedSummary === null) { $this->assertNull($cal); } else { |