From 48a9ecb0fecaed0f3be11c5157cb7d7d3feb7c27 Mon Sep 17 00:00:00 2001 From: Michael J Rubinsky Date: Wed, 1 Mar 2017 15:13:54 -0500 Subject: [PATCH] Bug: 14585 Fix saving sync prefs when no default resource exists. --- config/prefs.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/config/prefs.php b/config/prefs.php index 891eddb59..c1385148a 100644 --- a/config/prefs.php +++ b/config/prefs.php @@ -275,7 +275,11 @@ $enum = array(); $sync = @unserialize($GLOBALS['prefs']->getValue('sync_calendars')); if (empty($sync)) { - $GLOBALS['prefs']->setValue('sync_calendars', serialize(array(Kronolith::getDefaultCalendar()))); + $default_calendar = Kronolith::getDefaultCalendar(Horde_Perms::EDIT); + $sync_list = !empty($default_calendar) + ? array($default_calendar) + : array(); + $GLOBALS['prefs']->setValue('sync_calendars', serialize($sync_list)); } foreach (Kronolith::listInternalCalendars(!$GLOBALS['prefs']->getValue('activesync_no_multiplex'), Horde_Perms::DELETE) as $key => $cal) { if ($cal->getName() != Kronolith::getDefaultCalendar(Horde_Perms::DELETE)) { @@ -294,7 +298,7 @@ break; } } - if (!$haveDefault) { + if (!$haveDefault && !empty($default)) { $sync[] = $default; $GLOBALS['prefs']->setValue('sync_calendars', serialize($sync)); }