diff options
author | Georg Ehrke <developer@georgehrke.com> | 2018-01-04 20:15:24 +0100 |
---|---|---|
committer | Georg Ehrke <developer@georgehrke.com> | 2018-01-04 20:15:24 +0100 |
commit | 1b8fc260c6f06ddeb948f55a2985a20fb9149c3d (patch) | |
tree | 7fcfe8a74a4d41f40f9270ffee3533c1bf27ce71 /apps | |
parent | e6557324580e4f76107a059f9fe84b03fbae2b71 (diff) | |
download | nextcloud-server-1b8fc260c6f06ddeb948f55a2985a20fb9149c3d.tar.gz nextcloud-server-1b8fc260c6f06ddeb948f55a2985a20fb9149c3d.zip |
generate different UIDs for Birthday, Anniversary and Death event
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
Diffstat (limited to 'apps')
-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 62d218f0a2a..0f6e819bcc5 100644 --- a/apps/dav/lib/CalDAV/BirthdayService.php +++ b/apps/dav/lib/CalDAV/BirthdayService.php @@ -148,10 +148,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; } @@ -221,7 +222,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'; @@ -297,7 +298,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 867168033a4..739b81ddf01 100644 --- a/apps/dav/tests/unit/CardDAV/BirthdayServiceTest.php +++ b/apps/dav/tests/unit/CardDAV/BirthdayServiceTest.php @@ -64,7 +64,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 { |