Use personal address books first if determining the default one (Valentin Vidic,...
authorJan Schneider <jan@horde.org>
Thu, 25 Nov 2010 20:26:34 +0000 (21:26 +0100)
committerJan Schneider <jan@horde.org>
Thu, 25 Nov 2010 20:26:34 +0000 (21:26 +0100)
turba/docs/CHANGES
turba/lib/Turba.php

index 42cf84a..546d8df 100644 (file)
@@ -16,6 +16,8 @@ v3.0-git
 v2.3.6-cvs
 ----------
 
+[jan] Use personal address books first if determining the default one (Valentin
+      Vidic, Request #9367).
 [jan] Use name format preference not only for paging, but for sorting too
       (Request #8806).
 [jan] Fix photo corruption when exporting to vCard 3.0 (Bug #9100).
index da83197..0fda36d 100644 (file)
@@ -146,6 +146,16 @@ class Turba {
             }
         }
 
+        /* In case of shares select first user owned address book as default */
+        if (!empty($_SESSION['turba']['has_share'])) {
+            try {
+                $owned_shares = Turba::listShares(true);
+                if (count($owned_shares) > 0) {
+                    return key($owned_shares);
+                }
+            } catch (Exception $e) {}
+        }
+
         reset($GLOBALS['cfgSources']);
         return key($GLOBALS['cfgSources']);
     }