mirror of
https://github.com/nextcloud/server.git
synced 2026-06-10 09:13:19 -04:00
Modify check for missing UID.
Conflicts: apps/contacts/lib/vcard.php
This commit is contained in:
parent
a7d7525645
commit
a62ac84220
1 changed files with 12 additions and 4 deletions
|
|
@ -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()));
|
||||
|
|
|
|||
Loading…
Reference in a new issue