Fix PHP warning when adding contact to a group (Bug #1989)
This commit is contained in:
parent
cab58ba233
commit
bba45ce59d
2 changed files with 16 additions and 11 deletions
|
@ -821,13 +821,20 @@ class rcube_kolab_contacts extends rcube_addressbook
|
|||
foreach ($ids as $contact_id) {
|
||||
$uid = $this->id2uid($contact_id);
|
||||
if ($contact = $this->storagefolder->get_object($uid)) {
|
||||
foreach ($this->get_col_values('email', $contact, true) as $email)
|
||||
break;
|
||||
$email = '';
|
||||
if (empty($uid)) {
|
||||
foreach ($contact['email'] as $email) {
|
||||
if (is_array($email)) {
|
||||
$email = $email['address'];
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$list['member'][] = array(
|
||||
'uid' => $uid,
|
||||
'uid' => $uid,
|
||||
'email' => $email,
|
||||
'name' => self::compose_display_name($contact),
|
||||
'name' => self::compose_display_name($contact),
|
||||
);
|
||||
$this->groupmembers[$contact_id][] = $gid;
|
||||
$added++;
|
||||
|
@ -835,7 +842,7 @@ class rcube_kolab_contacts extends rcube_addressbook
|
|||
else if (strpos($uid, 'mailto:') === 0 && ($contact = $this->contacts[$contact_id])) {
|
||||
$list['member'][] = array(
|
||||
'email' => $contact['email'],
|
||||
'name' => $contact['name'],
|
||||
'name' => $contact['name'],
|
||||
);
|
||||
$this->groupmembers[$contact_id][] = $gid;
|
||||
$added++;
|
||||
|
@ -1096,7 +1103,7 @@ class rcube_kolab_contacts extends rcube_addressbook
|
|||
else if (!$contact['uid'] && $old['uid'])
|
||||
$contact['uid'] = $old['uid'];
|
||||
|
||||
$contact['im'] = array_filter($this->get_col_values('im', $contact, true));
|
||||
$contact['im'] = array_filter($this->get_col_values('im', $contact, true));
|
||||
|
||||
// convert email, website, phone values
|
||||
foreach (array('email'=>'address', 'website'=>'url', 'phone'=>'number') as $col => $propname) {
|
||||
|
|
|
@ -44,7 +44,6 @@ class kolab_format_distributionlist extends kolab_format
|
|||
|
||||
$this->obj->setName($object['name']);
|
||||
|
||||
$seen = array();
|
||||
$members = new vectorcontactref;
|
||||
foreach ((array)$object['member'] as $member) {
|
||||
if ($member['uid'])
|
||||
|
@ -56,7 +55,6 @@ class kolab_format_distributionlist extends kolab_format
|
|||
|
||||
$m->setName($member['name']);
|
||||
$members->push($m);
|
||||
$seen[$member['email']]++;
|
||||
}
|
||||
|
||||
$this->obj->setMembers($members);
|
||||
|
@ -100,11 +98,11 @@ class kolab_format_distributionlist extends kolab_format
|
|||
$members = $this->obj->members();
|
||||
for ($i=0; $i < $members->size(); $i++) {
|
||||
$member = $members->get($i);
|
||||
# if ($member->type() == ContactReference::UidReference && ($uid = $member->uid()))
|
||||
// if ($member->type() == ContactReference::UidReference && ($uid = $member->uid()))
|
||||
$object['member'][] = array(
|
||||
'uid' => $member->uid(),
|
||||
'uid' => $member->uid(),
|
||||
'email' => $member->email(),
|
||||
'name' => $member->name(),
|
||||
'name' => $member->name(),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue