mirror of
https://github.com/owncloudarchive/contacts.git
synced 2024-12-02 14:24:10 +01:00
Modify check for missing UID.
This commit is contained in:
parent
d9e31298bd
commit
d55aa3a8f7
@ -124,10 +124,9 @@ class OC_Contacts_VCard{
|
|||||||
OC_Log::write('contacts','OC_Contacts_VCard::add. Added missing \'N\' field: '.$n,OC_Log::DEBUG);
|
OC_Log::write('contacts','OC_Contacts_VCard::add. Added missing \'N\' field: '.$n,OC_Log::DEBUG);
|
||||||
}
|
}
|
||||||
$uid = $card->getAsString('UID');
|
$uid = $card->getAsString('UID');
|
||||||
if(is_null($uid)){
|
if(!$uid){
|
||||||
$card->setUID();
|
$card->setUID();
|
||||||
$uid = $card->getAsString('UID');
|
$uid = $card->getAsString('UID');
|
||||||
//$data = $card->serialize();
|
|
||||||
};
|
};
|
||||||
$uri = $uid.'.vcf';
|
$uri = $uid.'.vcf';
|
||||||
|
|
||||||
@ -176,7 +175,7 @@ class OC_Contacts_VCard{
|
|||||||
* @return insertid
|
* @return insertid
|
||||||
*/
|
*/
|
||||||
public static function addFromDAVData($id,$uri,$data){
|
public static function addFromDAVData($id,$uri,$data){
|
||||||
$fn = $n = null;
|
$fn = $n = $uid = null;
|
||||||
$email = null;
|
$email = null;
|
||||||
$card = OC_VObject::parse($data);
|
$card = OC_VObject::parse($data);
|
||||||
if(!is_null($card)){
|
if(!is_null($card)){
|
||||||
@ -187,6 +186,9 @@ class OC_Contacts_VCard{
|
|||||||
if($property->name == 'N'){
|
if($property->name == 'N'){
|
||||||
$n = $property->value;
|
$n = $property->value;
|
||||||
}
|
}
|
||||||
|
if($property->name == 'UID'){
|
||||||
|
$uid = $property->value;
|
||||||
|
}
|
||||||
if($property->name == 'EMAIL' && is_null($email)){
|
if($property->name == 'EMAIL' && is_null($email)){
|
||||||
$email = $property->value;
|
$email = $property->value;
|
||||||
}
|
}
|
||||||
@ -210,6 +212,10 @@ class OC_Contacts_VCard{
|
|||||||
$data = $card->serialize();
|
$data = $card->serialize();
|
||||||
OC_Log::write('contacts','OC_Contacts_VCard::add. Added missing \'N\' field: '.$n,OC_Log::DEBUG);
|
OC_Log::write('contacts','OC_Contacts_VCard::add. Added missing \'N\' field: '.$n,OC_Log::DEBUG);
|
||||||
}
|
}
|
||||||
|
if(!$uid) {
|
||||||
|
$card->setUID();
|
||||||
|
$data = $card->serialize();
|
||||||
|
}
|
||||||
|
|
||||||
$stmt = OC_DB::prepare( 'INSERT INTO *PREFIX*contacts_cards (addressbookid,fullname,carddata,uri,lastmodified) VALUES(?,?,?,?,?)' );
|
$stmt = OC_DB::prepare( 'INSERT INTO *PREFIX*contacts_cards (addressbookid,fullname,carddata,uri,lastmodified) VALUES(?,?,?,?,?)' );
|
||||||
$result = $stmt->execute(array($id,$fn,$data,$uri,time()));
|
$result = $stmt->execute(array($id,$fn,$data,$uri,time()));
|
||||||
|
Loading…
Reference in New Issue
Block a user