From 4d2fce1d0610036c53c1aafac57998c9e41d942f Mon Sep 17 00:00:00 2001 From: nathangray Date: Thu, 1 Sep 2016 09:26:56 -0600 Subject: [PATCH] Use user accounts when available over addressbook when expanding mailing lists --- calendar/inc/class.calendar_bo.inc.php | 10 +++++++++- calendar/inc/class.calendar_uiforms.inc.php | 5 ++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/calendar/inc/class.calendar_bo.inc.php b/calendar/inc/class.calendar_bo.inc.php index 1a01f392c0..173cec7172 100644 --- a/calendar/inc/class.calendar_bo.inc.php +++ b/calendar/inc/class.calendar_bo.inc.php @@ -395,7 +395,15 @@ class calendar_bo } foreach($lists as &$contact) { - $contact = 'c'.$contact['id']; + // Check for user account + if (($account_id = $GLOBALS['egw']->accounts->name2id($contact['id'],'person_id'))) + { + $contact = ''.$account_id; + } + else + { + $contact = 'c'.$contact['id']; + } if ($ignore_acl || $this->check_perms(ACL::READ|self::ACL_READ_FOR_PARTICIPANTS|($use_freebusy?self::ACL_FREEBUSY:0),0,$contact)) { if ($contact && !in_array($contact,$contact_list)) // already added? diff --git a/calendar/inc/class.calendar_uiforms.inc.php b/calendar/inc/class.calendar_uiforms.inc.php index ee49e78e2d..0f9072d70c 100644 --- a/calendar/inc/class.calendar_uiforms.inc.php +++ b/calendar/inc/class.calendar_uiforms.inc.php @@ -440,7 +440,10 @@ class calendar_uiforms extends calendar_ui { foreach($this->bo->enum_mailing_list($participant) as $contact) { - $event['participants'][$contact] = $event['participant_types']['c'][substr($contact,1)] = + // Mailing lists can contain users, so allow for that possibility + $_type = is_numeric($contact) ? '' : $contact[0]; + $_uid = is_numeric($contact) ? $contact : substr($contact,1); + $event['participants'][$contact] = $event['participant_types'][$_type][$_uid] = calendar_so::combine_status($status,$content['participants']['quantity'],$content['participants']['role']); } continue;