From 1d88af167cbf08b73d48a9f76afbc1a655a7ab24 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Mon, 4 May 2015 20:11:52 +0000 Subject: [PATCH] Remove 'No filters' option, as it causes errors --- .../class.calendar_favorite_portlet.inc.php | 21 ++++++++++++++++++- home/js/app.js | 4 +++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/calendar/inc/class.calendar_favorite_portlet.inc.php b/calendar/inc/class.calendar_favorite_portlet.inc.php index 675558ae8c..6041d1d41f 100644 --- a/calendar/inc/class.calendar_favorite_portlet.inc.php +++ b/calendar/inc/class.calendar_favorite_portlet.inc.php @@ -81,7 +81,7 @@ class calendar_favorite_portlet extends home_favorite_portlet } $content = array('legacy' => ''); - + switch($this->favorite['state']['view']) { case 'listview': @@ -197,4 +197,23 @@ class calendar_favorite_portlet extends home_favorite_portlet } } } + + /** + * No filters default favorite causes problems with calendar's special state handling, + * so just remove it. + * @return type + */ + public function get_properties() + { + $properties = parent::get_properties(); + foreach($properties as &$property) + { + if($property['name'] == 'favorite') + { + unset($property['select_options']['blank']); + break; + } + } + return $properties; + } } \ No newline at end of file diff --git a/home/js/app.js b/home/js/app.js index 76c9ee27ff..7d6d934653 100644 --- a/home/js/app.js +++ b/home/js/app.js @@ -878,7 +878,9 @@ app.classes.home.home_favorite_portlet = app.classes.home.home_portlet.extend({ this._super.apply(this, arguments); // Somehow favorite got lost, or is not set - if(!portlet.options.settings.favorite) + if(portlet.options && portlet.options.settings && typeof portlet.options.settings !== 'undefined' && + !portlet.options.settings.favorite + ) { portlet.edit_settings(); }