1
0
mirror of https://github.com/owncloudarchive/contacts.git synced 2025-02-07 01:54:16 +01:00

Merge pull request #801 from rehrumesh/786-TypeError-fix

#786 TypeError: addressBook is undefined error fixed
This commit is contained in:
jbtbnl 2015-02-10 13:42:02 +01:00
commit 4090d5672e

View File

@ -1094,31 +1094,35 @@ OC.notify = function(params) {
}); });
var addContact = function() { var addContact = function() {
console.log('add'); if(self.contacts.addressBooks.count() > 0){
if(self.currentid) { console.log('add');
if(self.currentid === 'new') { if(self.currentid) {
return; if(self.currentid === 'new') {
} else { return;
var contact = self.contacts.findById(self.currentid); } else {
if(contact) { var contact = self.contacts.findById(self.currentid);
contact.close(true); if(contact) {
} contact.close(true);
} }
} }
self.currentid = 'new'; }
// Properties that the contact doesn't know self.currentid = 'new';
console.log('addContact, groupid', self.currentgroup); // Properties that the contact doesn't know
var groupprops = { console.log('addContact, groupid', self.currentgroup);
favorite: false, var groupprops = {
groups: self.groups.categories, favorite: false,
currentgroup: {id:self.currentgroup, name:self.groups.nameById(self.currentgroup)} groups: self.groups.categories,
}; currentgroup: {id:self.currentgroup, name:self.groups.nameById(self.currentgroup)}
self.$firstRun.hide(); };
self.$contactList.show(); self.$firstRun.hide();
self.tmpcontact = self.contacts.addContact(groupprops); self.$contactList.show();
self.tmpcontact.prependTo(self.$contactList.find('tbody')).show().find('.fullname').focus(); self.tmpcontact = self.contacts.addContact(groupprops);
self.$rightContent.scrollTop(0); self.tmpcontact.prependTo(self.$contactList.find('tbody')).show().find('.fullname').focus();
self.hideActions(); self.$rightContent.scrollTop(0);
self.hideActions();
}else{
OC.dialogs.alert(t('contacts','Please create an addressbook first'),t('contacts','Contacts'));
}
}; };
this.$firstRun.on('click keydown', '.import', function(event) { this.$firstRun.on('click keydown', '.import', function(event) {