Merge branch 'master' of ssh://git.kolabsys.com/git/roundcube

This commit is contained in:
Thomas Bruederli 2011-07-27 16:06:31 +02:00
commit ce873f40cc

View file

@ -1092,10 +1092,13 @@ class rcube_kolab_contacts extends rcube_addressbook
}
}
$object['address'] = array();
foreach ($this->get_col_values('address', $contact) as $type => $values) {
if ($this->addresstypemap[$type])
$type = $this->addresstypemap[$type];
$updated = false;
$basekey = 'addr-' . $type . '-';
foreach ((array)$values as $adr) {
// switch type if slot is already taken
@ -1111,8 +1114,16 @@ class rcube_kolab_contacts extends rcube_addressbook
$object[$basekey . 'postal-code'] = $adr['zipcode'];
$object[$basekey . 'region'] = $adr['region'];
$object[$basekey . 'country'] = $adr['country'];
// Update existing address entry of this type
foreach($object['address'] as $index => $address) {
if ($address['type'] == $type) {
$object['address'][$index] = $new_address;
$updated = true;
}
}
}
else {
if (!$updated) {
$object['address'][] = array(
'type' => $type,
'street' => $adr['street'],