1
0
mirror of https://github.com/owncloudarchive/contacts.git synced 2024-12-01 13:24:10 +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 * @param $importEntry the entry configuration to update in SimpleXml format
* @value the value to update * @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($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'])) {
@ -86,17 +86,10 @@ 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->add('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);
} }
} }

View File

@ -158,12 +158,12 @@ class ImportCsvConnector extends ImportConnector {
$vcard->add($property); $vcard->add($property);
} else { } else {
$property = $this->getOrCreateVCardProperty($vcard, $importEntry->vcard_entry); $property = $this->getOrCreateVCardProperty($vcard, $importEntry->vcard_entry);
$this->updateProperty($property, $importEntry, trim($oneValue), $vcard); $this->updateProperty($property, $importEntry, trim($oneValue));
} }
} }
} else { } else {
$property = $this->getOrCreateVCardProperty($vcard, $importEntry->vcard_entry); $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])) { } 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") { if (isset($importEntry['image']) && $importEntry['image'] == "true") {
$this->updateImageProperty($property, $value); $this->updateImageProperty($property, $value);
} else { } 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") { if (isset($importEntry['image']) && $importEntry['image'] == "true") {
$this->updateImageProperty($property, $value); $this->updateImageProperty($property, $value);
} else { } 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); $dest->add($property);
} else { } else {
$property = $this->getOrCreateVCardProperty($dest, $importEntry->vcard_entry); $property = $this->getOrCreateVCardProperty($dest, $importEntry->vcard_entry);
$this->updateProperty($property, $importEntry, trim($oneValue), $dest); $this->updateProperty($property, $importEntry, trim($oneValue));
} }
} }
} else { } else {
$property = $this->getOrCreateVCardProperty($dest, $importEntry->vcard_entry); $property = $this->getOrCreateVCardProperty($dest, $importEntry->vcard_entry);
$this->updateProperty($property, $importEntry, $sourceProperty->getValue(), $dest); $this->updateProperty($property, $importEntry, $sourceProperty->getValue());
} }
} }
} else { } else {