Skip to content

Commit

Permalink
Adding prefix, suffix and middle name to contacts.
Browse files Browse the repository at this point in the history
These fields are not being migrated. According to the following sources, this can be achieved: 

https://www.evenx.com/vcard-3-0-format-specification

https://developers.google.com/people/api/rest/v1/people?hl=en#Person.Name

Signed-off-by: tetebueno <[email protected]>
  • Loading branch information
tetebueno authored Dec 7, 2023
1 parent 30edd87 commit ba1957d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/Service/GoogleContactsAPIService.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,11 @@ public function importContacts(string $userId, ?string $uri, int $key, ?string $
$displayName = $n['displayName'] ?? '';
$familyName = $n['familyName'] ?? '';
$firstName = $n['givenName'] ?? '';
if ($familyName || $firstName) {
$prop = $vCard->createProperty('N', [0 => $familyName, 1 => $firstName, 2 => '', 3 => '', 4 => '']);
$additionalName = $n['middleName'] ?? '';
$prefix = $n['honorificPrefix'] ?? '';
$suffix = $n['honorificSuffix'] ?? '';
if ($familyName || $firstName || $additionalName || $prefix || $suffix) {
$prop = $vCard->createProperty('N', [0 => $familyName, 1 => $firstName, 2 => $additionalName, 3 => $prefix, 4 => $suffix]);
$vCard->add($prop);
}
break;
Expand Down

0 comments on commit ba1957d

Please sign in to comment.