Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/maps.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorArne Hamann <kontakt+github@arne.email>2022-05-19 11:03:49 +0300
committerGitHub <noreply@github.com>2022-05-19 11:03:49 +0300
commitfeb13a10adcc438b3c0ccfb0b2ba0e5fc707f83e (patch)
tree0057d29484ed1cb766b8422d13478ea3d63569e6 /lib
parent906d54d46c1e9cc3d40be08f6cfe26556f9f3299 (diff)
parent5abf68d156db1cf3870a953553c885e796de5e95 (diff)
Merge pull request #709 from nextcloud/contact-GEO-backend
Fixes Handling of GEO attribute in ContactsController
Diffstat (limited to 'lib')
-rw-r--r--lib/Controller/ContactsController.php29
1 files changed, 25 insertions, 4 deletions
diff --git a/lib/Controller/ContactsController.php b/lib/Controller/ContactsController.php
index 12327cdf..715eba59 100644
--- a/lib/Controller/ContactsController.php
+++ b/lib/Controller/ContactsController.php
@@ -82,7 +82,22 @@ class ContactsController extends Controller {
'GEO' => $geo,
'GROUPS' => $c['CATEGORIES'] ?? null
]);
- }
+ } elseif (count($geo)>0) {
+ foreach ($geo as $g) {
+ array_push($result, [
+ 'FN' => $c['FN'] ?? $this->N2FN($c['N']) ?? '???',
+ 'URI' => $c['URI'],
+ 'UID' => $c['UID'],
+ 'ADR' => '',
+ 'ADRTYPE' => '',
+ 'HAS_PHOTO' => (isset($c['PHOTO']) && $c['PHOTO'] !== null),
+ 'BOOKID' => $c['addressbook-key'],
+ 'BOOKURI' => $addressBookUri,
+ 'GEO' => $g,
+ 'GROUPS' => $c['CATEGORIES'] ?? null
+ ]);
+ }
+ }
}
// anyway try to get it from the address
$card = $this->cdBackend->getContact($c['addressbook-key'], $c['URI']);
@@ -288,11 +303,11 @@ class ContactsController extends Controller {
* and delete corresponding entry in the DB
* @NoAdminRequired
*/
- public function deleteContactAddress($bookid, $uri, $uid, $adr) {
+ public function deleteContactAddress($bookid, $uri, $uid, $adr, $geo) {
// vcard
$card = $this->cdBackend->getContact($bookid, $uri);
if ($card) {
- $vcard = Reader::read($card['carddata']);;
+ $vcard = Reader::read($card['carddata']);
//$bookId = $card['addressbookid'];
if (!$this->addressBookIsReadOnly($bookid)) {
foreach ($vcard->children() as $property) {
@@ -302,7 +317,13 @@ class ContactsController extends Controller {
$vcard->remove($property);
break;
}
- }
+ } elseif ($property->name === 'GEO') {
+ $cardAdr = $property->getValue();
+ if ($cardAdr === $geo) {
+ $vcard->remove($property);
+ break;
+ }
+ }
}
$this->cdBackend->updateCard($bookid, $uri, $vcard->serialize());
// no need to cleanup db here, it will be done when catching vcard change hook