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 b99ff32 commit 11a04dc
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions config/prefs.php
Expand Up @@ -278,7 +278,11 @@
$enum = array();
$sync = @unserialize($GLOBALS['prefs']->getValue('sync_lists'));
if (empty($sync)) {
$GLOBALS['prefs']->setValue('sync_lists', serialize(array(Nag::getDefaultTasklist(Horde_Perms::DELETE))));
$default_tasklist = Nag::getDefaultTasklist(Horde_Perms::DELETE);
$sync_list = !empty($default_tasklist)
? array($default_tasklist)
: array();
$GLOBALS['prefs']->setValue('sync_lists', serialize($sync_list));
}
foreach (Nag::listTasklists(false, Horde_Perms::DELETE, false) as $key => $list) {
if ($list->getName() != Nag::getDefaultTasklist(Horde_Perms::DELETE)) {
Expand All @@ -297,7 +301,7 @@
break;
}
}
if (!$haveDefault) {
if (!$haveDefault && !empty($default)) {
$sync[] = $default;
$GLOBALS['prefs']->setValue('sync_lists', serialize($sync));
}
Expand Down

0 comments on commit 11a04dc

Please sign in to comment.