diff options
author | Thomas Tanghus <thomas@tanghus.net> | 2012-02-14 04:56:38 +0400 |
---|---|---|
committer | Thomas Tanghus <thomas@tanghus.net> | 2012-03-12 22:41:25 +0400 |
commit | a62ac84220c9c414fa109dedad29f512aaed3d65 (patch) | |
tree | 061df691c748b35b6200a820c7216a7d8cf9f5e4 /apps | |
parent | a7d7525645beb5b492c1111f638216a9726bdb7d (diff) |
Modify check for missing UID.
Conflicts:
apps/contacts/lib/vcard.php
Diffstat (limited to 'apps')
-rw-r--r-- | apps/contacts/lib/vcard.php | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/apps/contacts/lib/vcard.php b/apps/contacts/lib/vcard.php index ceac2dcfad2..619c124af88 100644 --- a/apps/contacts/lib/vcard.php +++ b/apps/contacts/lib/vcard.php @@ -108,10 +108,9 @@ class OC_Contacts_VCard{ if(!is_null($card)){ $fn = $card->getAsString('FN'); $uid = $card->getAsString('UID'); - if(is_null($uid)){ + if(!$uid){ $card->setUID(); $uid = $card->getAsString('UID'); - //$data = $card->serialize(); }; $uri = $uid.'.vcf'; @@ -158,14 +157,19 @@ class OC_Contacts_VCard{ * @return insertid */ public static function addFromDAVData($id,$uri,$data){ - $fn = null; - $email = null; + $fn = $n = $uid = $email = null; $card = OC_VObject::parse($data); if(!is_null($card)){ foreach($card->children as $property){ if($property->name == 'FN'){ $fn = $property->value; } + if($property->name == 'N'){ + $n = $property->value; + } + if($property->name == 'UID'){ + $uid = $property->value; + } if($property->name == 'EMAIL' && is_null($email)){ $email = $property->value; } @@ -180,6 +184,10 @@ class OC_Contacts_VCard{ $card->addProperty('EMAIL', $email); $data = $card->serialize(); } + if(!$uid) { + $card->setUID(); + $data = $card->serialize(); + } $stmt = OC_DB::prepare( 'INSERT INTO *PREFIX*contacts_cards (addressbookid,fullname,carddata,uri,lastmodified) VALUES(?,?,?,?,?)' ); $result = $stmt->execute(array($id,$fn,$data,$uri,time())); |