generate different UIDs for Birthday, Anniversary and Death event

Signed-off-by: Georg Ehrke <developer@georgehrke.com>
This commit is contained in:
Georg Ehrke 2018-01-04 20:15:24 +01:00 committed by Roeland Jago Douma
parent ac8d572102
commit 8b28e91dcb
No known key found for this signature in database
GPG Key ID: F941078878347C0C
2 changed files with 5 additions and 4 deletions

View File

@ -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)) {

View File

@ -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 {