Merge branch 'master' of ssh://git.kolabsys.com/git/roundcube
This commit is contained in:
commit
ce873f40cc
1 changed files with 12 additions and 1 deletions
|
@ -1092,10 +1092,13 @@ class rcube_kolab_contacts extends rcube_addressbook
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$object['address'] = array();
|
||||||
|
|
||||||
foreach ($this->get_col_values('address', $contact) as $type => $values) {
|
foreach ($this->get_col_values('address', $contact) as $type => $values) {
|
||||||
if ($this->addresstypemap[$type])
|
if ($this->addresstypemap[$type])
|
||||||
$type = $this->addresstypemap[$type];
|
$type = $this->addresstypemap[$type];
|
||||||
|
|
||||||
|
$updated = false;
|
||||||
$basekey = 'addr-' . $type . '-';
|
$basekey = 'addr-' . $type . '-';
|
||||||
foreach ((array)$values as $adr) {
|
foreach ((array)$values as $adr) {
|
||||||
// switch type if slot is already taken
|
// 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 . 'postal-code'] = $adr['zipcode'];
|
||||||
$object[$basekey . 'region'] = $adr['region'];
|
$object[$basekey . 'region'] = $adr['region'];
|
||||||
$object[$basekey . 'country'] = $adr['country'];
|
$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(
|
$object['address'][] = array(
|
||||||
'type' => $type,
|
'type' => $type,
|
||||||
'street' => $adr['street'],
|
'street' => $adr['street'],
|
||||||
|
|
Loading…
Add table
Reference in a new issue