mirror of
https://github.com/owncloudarchive/contacts.git
synced 2024-11-29 11:24:11 +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);
|
||||
}
|
||||
$uid = $card->getAsString('UID');
|
||||
if(is_null($uid)){
|
||||
if(!$uid){
|
||||
$card->setUID();
|
||||
$uid = $card->getAsString('UID');
|
||||
//$data = $card->serialize();
|
||||
};
|
||||
$uri = $uid.'.vcf';
|
||||
|
||||
@ -176,7 +175,7 @@ class OC_Contacts_VCard{
|
||||
* @return insertid
|
||||
*/
|
||||
public static function addFromDAVData($id,$uri,$data){
|
||||
$fn = $n = null;
|
||||
$fn = $n = $uid = null;
|
||||
$email = null;
|
||||
$card = OC_VObject::parse($data);
|
||||
if(!is_null($card)){
|
||||
@ -187,6 +186,9 @@ class OC_Contacts_VCard{
|
||||
if($property->name == 'N'){
|
||||
$n = $property->value;
|
||||
}
|
||||
if($property->name == 'UID'){
|
||||
$uid = $property->value;
|
||||
}
|
||||
if($property->name == 'EMAIL' && is_null($email)){
|
||||
$email = $property->value;
|
||||
}
|
||||
@ -210,6 +212,10 @@ class OC_Contacts_VCard{
|
||||
$data = $card->serialize();
|
||||
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(?,?,?,?,?)' );
|
||||
$result = $stmt->execute(array($id,$fn,$data,$uri,time()));
|
||||
|
Loading…
Reference in New Issue
Block a user