forked from extern/egroupware
Merge custom fields when merging contacts
This commit is contained in:
parent
e86c74ef5d
commit
92e1b0b75b
@ -1525,6 +1525,8 @@ class addressbook_bo extends addressbook_so
|
|||||||
{
|
{
|
||||||
$this->error = false;
|
$this->error = false;
|
||||||
$account = null;
|
$account = null;
|
||||||
|
$custom_fields = config::get_customfields('addressbook', true);
|
||||||
|
$custom_field_list = $this->read_customfields($ids);
|
||||||
foreach(parent::search(array('id'=>$ids),false) as $contact) // $this->search calls the extended search from ui!
|
foreach(parent::search(array('id'=>$ids),false) as $contact) // $this->search calls the extended search from ui!
|
||||||
{
|
{
|
||||||
if ($contact['account_id'])
|
if ($contact['account_id'])
|
||||||
@ -1537,6 +1539,9 @@ class addressbook_bo extends addressbook_so
|
|||||||
$account = $contact;
|
$account = $contact;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
// Add in custom fields
|
||||||
|
$contact = array_merge($contact, $custom_field_list[$contact['id']]);
|
||||||
|
|
||||||
$pos = array_search($contact['id'],$ids);
|
$pos = array_search($contact['id'],$ids);
|
||||||
$contacts[$pos] = $contact;
|
$contacts[$pos] = $contact;
|
||||||
}
|
}
|
||||||
@ -1576,6 +1581,14 @@ class addressbook_bo extends addressbook_so
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
// Multi-select custom fields can also be merged
|
||||||
|
if($name[0] == '#') {
|
||||||
|
$c_name = substr($name, 1);
|
||||||
|
if($custom_fields[$c_name]['type'] == 'select' && $custom_fields[$c_name]['rows'] > 1) {
|
||||||
|
if (!is_array($target[$name])) $target[$name] = $target[$name] ? explode(',',$target[$name]) : array();
|
||||||
|
$target[$name] = implode(',',array_unique(array_merge($target[$name],is_array($value)?$value:explode(',',$value))));
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!$target[$name]) $target[$name] = $value;
|
if (!$target[$name]) $target[$name] = $value;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user