summaryrefslogtreecommitdiff
path: root/program/steps/mail/addcontact.inc
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2011-05-27 11:22:56 +0000
committeralecpl <alec@alec.pl>2011-05-27 11:22:56 +0000
commitd7344819834e469c2e5875f756f1ad973b2e06d9 (patch)
tree67eb614932f12ea756b0cd390b23253cfc095c50 /program/steps/mail/addcontact.inc
parentf5a55bf173be2378db79860ced8486374971e72f (diff)
- Added option to specify to which address book add new contacts
Diffstat (limited to 'program/steps/mail/addcontact.inc')
-rw-r--r--program/steps/mail/addcontact.inc12
1 files changed, 10 insertions, 2 deletions
diff --git a/program/steps/mail/addcontact.inc b/program/steps/mail/addcontact.inc
index 0baf6cd63..57bc2a1c6 100644
--- a/program/steps/mail/addcontact.inc
+++ b/program/steps/mail/addcontact.inc
@@ -23,8 +23,16 @@
if (!$OUTPUT->ajax_call)
return;
-$done = false;
-$CONTACTS = $RCMAIL->get_address_book(null, true);
+$abook = $RCMAIL->config->get('default_addressbook');
+
+// Get configured addressbook
+$CONTACTS = $RCMAIL->get_address_book($abook, true);
+
+// Get first writeable addressbook if the configured doesn't exist
+// This can happen when user deleted the addressbook (e.g. Kolab folder)
+if ($abook !== null && !is_object($CONTACTS)) {
+ $CONTACTS = $RCMAIL->get_address_book(null, true);
+}
if (!empty($_POST['_address']) && is_object($CONTACTS))
{