Skip to content

Commit

Permalink
Bug: 14585 Fix saving sync prefs when no default resource exists.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrubinsk committed Mar 1, 2017
1 parent b135c8c commit 48a9ecb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions config/prefs.php
Expand Up @@ -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)) {
Expand All @@ -294,7 +298,7 @@
break;
}
}
if (!$haveDefault) {
if (!$haveDefault && !empty($default)) {
$sync[] = $default;
$GLOBALS['prefs']->setValue('sync_calendars', serialize($sync));
}
Expand Down

0 comments on commit 48a9ecb

Please sign in to comment.