1
0
mirror of https://github.com/owncloudarchive/contacts.git synced 2024-11-29 11:24:11 +01:00
This commit is contained in:
babelouest 2015-05-23 17:57:14 -04:00
parent dcf242f501
commit c4c1a1fa6b
4 changed files with 10 additions and 17 deletions

View File

@ -58,7 +58,7 @@ abstract class ImportConnector {
* @param $importEntry the entry configuration to update in SimpleXml format
* @value the value to update
*/
protected function updateProperty(&$property, $importEntry, $value, $root = null) {
protected function updateProperty(&$property, $importEntry, $value) {
if (isset($property) && isset($importEntry) && isset($value)) {
if (isset($importEntry->vcard_entry)) {
if (isset($importEntry->vcard_entry['type'])) {
@ -86,17 +86,10 @@ abstract class ImportConnector {
$property->setValue(implode($separator, $vArray));
} else {
if (isset($importEntry->vcard_entry['value'])) {
$property->add('TYPE', StringUtil::convertToUTF8($value));
$property->add('TYPE', StringUtil::convertToUTF8($value));
} else {
$curVal = $property->getValue();
if ($curVal != '') {
if (!is_array($curVal)) {
$curVal = array($curVal);
}
$curVal[] = StringUtil::convertToUTF8($value);
} else {
$curVal = StringUtil::convertToUTF8($value);
}
$curVal = $property->getParts();
$curVal[] = StringUtil::convertToUTF8($value);
$property->setValue($curVal);
}
}

View File

@ -158,12 +158,12 @@ class ImportCsvConnector extends ImportConnector {
$vcard->add($property);
} else {
$property = $this->getOrCreateVCardProperty($vcard, $importEntry->vcard_entry);
$this->updateProperty($property, $importEntry, trim($oneValue), $vcard);
$this->updateProperty($property, $importEntry, trim($oneValue));
}
}
} else {
$property = $this->getOrCreateVCardProperty($vcard, $importEntry->vcard_entry);
$this->updateProperty($property, $importEntry, trim($oneValue), $vcard);
$this->updateProperty($property, $importEntry, trim($oneValue));
}
}
} else if (isset($element[$i]) && isset($title[$i])) {

View File

@ -163,7 +163,7 @@ class ImportLdifConnector extends ImportConnector{
if (isset($importEntry['image']) && $importEntry['image'] == "true") {
$this->updateImageProperty($property, $value);
} else {
$this->updateProperty($property, $importEntry, $value, $dest);
$this->updateProperty($property, $importEntry, $value);
}
}
}
@ -172,7 +172,7 @@ class ImportLdifConnector extends ImportConnector{
if (isset($importEntry['image']) && $importEntry['image'] == "true") {
$this->updateImageProperty($property, $value);
} else {
$this->updateProperty($property, $importEntry, $value, $dest);
$this->updateProperty($property, $importEntry, $value);
}
}
}

View File

@ -133,12 +133,12 @@ class ImportVCardConnector extends ImportConnector{
$dest->add($property);
} else {
$property = $this->getOrCreateVCardProperty($dest, $importEntry->vcard_entry);
$this->updateProperty($property, $importEntry, trim($oneValue), $dest);
$this->updateProperty($property, $importEntry, trim($oneValue));
}
}
} else {
$property = $this->getOrCreateVCardProperty($dest, $importEntry->vcard_entry);
$this->updateProperty($property, $importEntry, $sourceProperty->getValue(), $dest);
$this->updateProperty($property, $importEntry, $sourceProperty->getValue());
}
}
} else {