Clean empty values in contact data, fixes #267
This commit is contained in:
parent
ae4b2d6b51
commit
909d2c43a7
1 changed files with 6 additions and 1 deletions
|
@ -1124,7 +1124,7 @@ class rcube_kolab_contacts extends rcube_addressbook
|
||||||
$emails = $this->get_col_values('email', $contact, true);
|
$emails = $this->get_col_values('email', $contact, true);
|
||||||
$object['emails'] = join(', ', array_filter($emails));
|
$object['emails'] = join(', ', array_filter($emails));
|
||||||
// overwrite 'email' field
|
// overwrite 'email' field
|
||||||
$object['email'] = '';
|
unset($object['email']);
|
||||||
|
|
||||||
foreach ($this->get_col_values('phone', $contact) as $type => $values) {
|
foreach ($this->get_col_values('phone', $contact) as $type => $values) {
|
||||||
if ($this->phonetypemap[$type])
|
if ($this->phonetypemap[$type])
|
||||||
|
@ -1146,6 +1146,11 @@ class rcube_kolab_contacts extends rcube_addressbook
|
||||||
$updated = false;
|
$updated = false;
|
||||||
$basekey = 'addr-' . $type . '-';
|
$basekey = 'addr-' . $type . '-';
|
||||||
foreach ((array)$values as $adr) {
|
foreach ((array)$values as $adr) {
|
||||||
|
// skip empty address
|
||||||
|
$adr = array_filter($adr);
|
||||||
|
if (empty($adr))
|
||||||
|
continue;
|
||||||
|
|
||||||
// switch type if slot is already taken
|
// switch type if slot is already taken
|
||||||
if (isset($object[$basekey . 'type'])) {
|
if (isset($object[$basekey . 'type'])) {
|
||||||
$type = $type == 'home' ? 'business' : 'home';
|
$type = $type == 'home' ? 'business' : 'home';
|
||||||
|
|
Loading…
Add table
Reference in a new issue