diff --git a/calendar/inc/class.calendar_favorite_portlet.inc.php b/calendar/inc/class.calendar_favorite_portlet.inc.php index 406310225a..675558ae8c 100644 --- a/calendar/inc/class.calendar_favorite_portlet.inc.php +++ b/calendar/inc/class.calendar_favorite_portlet.inc.php @@ -64,13 +64,15 @@ class calendar_favorite_portlet extends home_favorite_portlet else { $ui = new calendar_uiviews(); - if($this->favorite['state']['start']) $ui->search_params['start'] = $this->favorite['state']['start']; - if($this->favorite['state']['cat_id']) $ui->search_params['cat_id'] = $this->favorite['state']['cat_id']; - // Owner can be 0 for current user - if(array_key_exists('owner',$this->favorite['state'])) $ui->search_params['users'] = explode(',',$this->favorite['state']['owner']); - if($this->favorite['state']['filter']) $ui->search_params['filter'] = $this->favorite['state']['filter']; - if($this->favorite['state']['sortby']) $ui->search_params['sortby'] = $this->favorite['state']['sortby']; - + if ($this->favorite) + { + if($this->favorite['state']['start']) $ui->search_params['start'] = $this->favorite['state']['start']; + if($this->favorite['state']['cat_id']) $ui->search_params['cat_id'] = $this->favorite['state']['cat_id']; + // Owner can be 0 for current user + if(array_key_exists('owner',$this->favorite['state'])) $ui->search_params['users'] = explode(',',$this->favorite['state']['owner']); + if($this->favorite['state']['filter']) $ui->search_params['filter'] = $this->favorite['state']['filter']; + if($this->favorite['state']['sortby']) $ui->search_params['sortby'] = $this->favorite['state']['sortby']; + } $etemplate->read('home.legacy'); $etemplate->set_dom_id($id); diff --git a/home/inc/class.home_favorite_portlet.inc.php b/home/inc/class.home_favorite_portlet.inc.php index d2d87fca70..73d7d3e894 100644 --- a/home/inc/class.home_favorite_portlet.inc.php +++ b/home/inc/class.home_favorite_portlet.inc.php @@ -187,7 +187,10 @@ class home_favorite_portlet extends home_portlet $favorite_list = array(); foreach($favorites as $id => $favorite) { - $favorite_list[$id] = $favorite['name']; + if($favorite) + { + $favorite_list[$id] = $favorite['name']; + } } $favorite = array( 'label' => lang('Favorite'), diff --git a/home/js/app.js b/home/js/app.js index 3826d3a58f..76c9ee27ff 100644 --- a/home/js/app.js +++ b/home/js/app.js @@ -873,6 +873,16 @@ app.classes.home.home_weather_portlet = app.classes.home.home_portlet.extend({ } }); app.classes.home.home_favorite_portlet = app.classes.home.home_portlet.extend({ + init: function(portlet) { + // call parent + this._super.apply(this, arguments); + + // Somehow favorite got lost, or is not set + if(!portlet.options.settings.favorite) + { + portlet.edit_settings(); + } + }, observer: function(_msg, _app, _id, _type, _msg_type, _targetapp) { if(this.portlet.class.indexOf(_app) == 0 || this.portlet.class == 'home_favorite_portlet')