From 35eda073ddc6618b06a2ece9b59051b23601ad81 Mon Sep 17 00:00:00 2001 From: nathangray Date: Wed, 20 Jul 2016 12:39:06 -0600 Subject: [PATCH] Fix distribution lists calendars to work when first added from search results --- calendar/inc/class.calendar_bo.inc.php | 2 +- .../inc/class.calendar_owner_etemplate_widget.inc.php | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/calendar/inc/class.calendar_bo.inc.php b/calendar/inc/class.calendar_bo.inc.php index cd63ca2b2d..f4545ee0dd 100644 --- a/calendar/inc/class.calendar_bo.inc.php +++ b/calendar/inc/class.calendar_bo.inc.php @@ -254,7 +254,7 @@ class calendar_bo $this->resources['l'] = array( 'type' => 'l',// one char type-identifier for this resources 'info' => __CLASS__ .'::mailing_lists',// info method, returns array with id, type & name for a given id - 'app' => 'Mailing list' + 'app' => 'Distribution list' ); $this->resources[''] = array( 'type' => '', diff --git a/calendar/inc/class.calendar_owner_etemplate_widget.inc.php b/calendar/inc/class.calendar_owner_etemplate_widget.inc.php index c6d234f79f..8bfc3eeee0 100644 --- a/calendar/inc/class.calendar_owner_etemplate_widget.inc.php +++ b/calendar/inc/class.calendar_owner_etemplate_widget.inc.php @@ -174,12 +174,19 @@ class calendar_owner_etemplate_widget extends Etemplate\Widget\Taglist { // Include mailing lists $contacts_obj = new Api\Contacts(); - $_results += array_filter( + $lists = array_filter( $contacts_obj->get_lists(Api\Acl::READ), function($element) use($query) { return (stripos($element, $query) !== false); } ); + foreach($lists as $list_id => $list) + { + $_results[$list_id] = array( + 'label' => $list, + 'resources' => $bo->enum_mailing_list($type.$list_id) + ); + } } if(!$_results) {