1
0
mirror of https://github.com/owncloudarchive/contacts.git synced 2025-02-07 01:54:16 +01:00

Merge pull request #906 from owncloud/fix_880_905

Fix #880 #905
This commit is contained in:
Thomas Müller 2015-06-26 17:55:26 +02:00
commit 1a37138ec3
3 changed files with 9 additions and 16 deletions

View File

@ -62,11 +62,11 @@ abstract class ImportConnector {
if (isset($property) && isset($importEntry) && isset($value)) { if (isset($property) && isset($importEntry) && isset($value)) {
if (isset($importEntry->vcard_entry)) { if (isset($importEntry->vcard_entry)) {
if (isset($importEntry->vcard_entry['type'])) { if (isset($importEntry->vcard_entry['type'])) {
$property->parameters[] = new \Sabre\VObject\Parameter('TYPE', ''.StringUtil::convertToUTF8($importEntry->vcard_entry['type'])); $property->add('TYPE', StringUtil::convertToUTF8($importEntry->vcard_entry['type']));
} }
if (isset($importEntry->vcard_entry->additional_property)) { if (isset($importEntry->vcard_entry->additional_property)) {
foreach ($importEntry->vcard_entry->additional_property as $additionalProperty) { foreach ($importEntry->vcard_entry->additional_property as $additionalProperty) {
$property->parameters[] = new \Sabre\VObject\Parameter(''.$additionalProperty['name'], ''.$additionalProperty['value']); $property->add($additionalProperty['name'], $additionalProperty['value']);
} }
} }
if (isset($importEntry->vcard_entry['prefix'])) { if (isset($importEntry->vcard_entry['prefix'])) {
@ -86,23 +86,16 @@ abstract class ImportConnector {
$property->setValue(implode($separator, $vArray)); $property->setValue(implode($separator, $vArray));
} else { } else {
if (isset($importEntry->vcard_entry['value'])) { if (isset($importEntry->vcard_entry['value'])) {
$property->parameters[] = new \Sabre\VObject\Parameter('TYPE', ''.StringUtil::convertToUTF8($value)); $property->add('TYPE', StringUtil::convertToUTF8($value));
} else { } else {
$curVal = $property->getValue(); $curVal = $property->getParts();
if ($curVal != '') { $curVal[] = StringUtil::convertToUTF8($value);
if (!is_array($curVal)) {
$curVal = array($curVal);
}
$curVal[] = StringUtil::convertToUTF8($value);
} else {
$curVal = StringUtil::convertToUTF8($value);
}
$property->setValue($curVal); $property->setValue($curVal);
} }
} }
} }
if (isset($importEntry->vcard_parameter)) { if (isset($importEntry->vcard_parameter)) {
$property->parameters[] = new \Sabre\VObject\Parameter($importEntry->vcard_parameter['parameter'], ''.StringUtil::convertToUTF8($value)); $property->add($importEntry->vcard_parameter['parameter'], StringUtil::convertToUTF8($value));
} }
} }
} }
@ -168,7 +161,7 @@ abstract class ImportConnector {
$property = $vcard->createProperty($importEntry['property']); $property = $vcard->createProperty($importEntry['property']);
$vcard->add($property); $vcard->add($property);
if ($importEntry['type']!=null) { if ($importEntry['type']!=null) {
$property->parameters[] = new \Sabre\VObject\Parameter('TYPE', ''.StringUtil::convertToUTF8($importEntry['type'])); $property->add('TYPE', StringUtil::convertToUTF8($importEntry['type']));
switch ($importEntry['property']) { switch ($importEntry['property']) {
case "ADR": case "ADR":
$property->setValue(";;;;;;"); $property->setValue(";;;;;;");

View File

@ -168,7 +168,7 @@ class ImportCsvConnector extends ImportConnector {
} }
} else if (isset($element[$i]) && isset($title[$i])) { } else if (isset($element[$i]) && isset($title[$i])) {
$property = $vcard->createProperty("X-Unknown-Element", StringUtil::convertToUTF8($element[$i])); $property = $vcard->createProperty("X-Unknown-Element", StringUtil::convertToUTF8($element[$i]));
$property->parameters[] = new \Sabre\VObject\Parameter('TYPE', ''.StringUtil::convertToUTF8($title[$i])); $property->add('TYPE', StringUtil::convertToUTF8($title[$i]));
$vcard->add($property); $vcard->add($property);
} }
} }

View File

@ -136,7 +136,7 @@ class ImportLdifConnector extends ImportConnector{
} }
} else { } else {
$property = $dest->createProperty("X-Unknown-Element", ''.StringUtil::convertToUTF8($ldifProperty[1])); $property = $dest->createProperty("X-Unknown-Element", ''.StringUtil::convertToUTF8($ldifProperty[1]));
$property->parameters[] = new \Sabre\VObject\Parameter('TYPE', ''.StringUtil::convertToUTF8($ldifProperty[0])); $property->add('TYPE', StringUtil::convertToUTF8($ldifProperty[0]));
$dest->add($property); $dest->add($property);
} }
} }