Contacts: Fix for not being able to add contact to empty/non-existant address book.

This commit is contained in:
Thomas Tanghus 2012-04-09 16:29:56 +02:00
parent 9c247ce874
commit 4fda6af725
3 changed files with 2 additions and 4 deletions

View File

@ -47,8 +47,6 @@ OC_Contacts_App::getAddressbook( $aid ); // is owner access check
$fn = trim($_POST['fn']);
$n = trim($_POST['n']);
debug('N: '.$n);
debug('FN: '.$fn);
$vcard = new OC_VObject('VCARD');
$vcard->setUID();

View File

@ -56,7 +56,7 @@ dl.form { width: 100%; float: left; clear: right; margin: 0; padding: 0; }
.contactpart legend { width:auto; padding:.3em; border:1px solid #ddd; font-weight:bold; cursor:pointer; background:#f8f8f8; color:#555; text-shadow:#fff 0 1px 0; -moz-box-shadow:0 1px 1px #fff, 0 1px 1px #fff inset; -webkit-box-shadow:0 1px 1px #fff, 0 1px 1px #fff inset; -moz-border-radius:.5em; -webkit-border-radius:.5em; border-radius:.5em; }
#cropbox { margin: auto; }
#contacts_details_photo { border-radius: 0.5em; border: thin solid #bbb; padding: 0.5em; margin: 0.3em; cursor: pointer; background: url(../../../core/img/loading.gif) no-repeat center center; display: block; /* clear: right;*/ }
#contacts_details_photo { border-radius: 0.5em; border: thin solid #bbb; margin: 0.3em; cursor: pointer; background: url(../../../core/img/loading.gif) no-repeat center center; display: block; /* clear: right;*/ }
#contacts_details_photo:hover { background: #fff; }
/*#contacts_details_photo_progress { margin: 0.3em 0.3em 0.3em 7em; clear: left; }*/
/* Address editor */

View File

@ -169,7 +169,7 @@ class OC_Contacts_Addressbook{
$uid = OC_User::getUser();
}
$prefbooks = OC_Preferences::getValue($uid,'contacts','openaddressbooks',null);
if(is_null($prefbooks)){
if(!$prefbooks){
$addressbooks = OC_Contacts_Addressbook::all($uid);
if(count($addressbooks) == 0){
OC_Contacts_Addressbook::add($uid,'default','Default Address Book');