Check to see if selected account is not in cache before adding it in.

Fixes  [object object] as acl_account option
This commit is contained in:
Nathan Gray 2014-06-09 22:09:37 +00:00
parent a9e37042cb
commit a98925d287

View File

@ -433,17 +433,25 @@ app.classes.admin = AppJS.extend(
} }
} }
// Make sure selected values are there // Make sure selected values are there, account might not be in a default group
// so not in cache
if(content.acl_account) if(content.acl_account)
{ {
sel_options.acl_account = jQuery.extend({},sel_options.acl_account); var accounts = this.egw.accounts('both');
this.egw.link_title('home-accounts', content.acl_account, function(title) {sel_options.acl_account[content.acl_account] = title;}); var there = false;
} for(var i = 0; i < accounts.length; i++)
if(content.acl_account != this.et2.getWidgetById('nm').getArrayMgr('content').getEntry('account_id')) {
{ if(accounts[i].value == content.acl_account)
var account = this.et2.getWidgetById('nm').getArrayMgr('content').getEntry('account_id'); {
sel_options.acl_account[account] = 'loading'; there = true;
this.egw.link_title('home-accounts', account, function(title) {sel_options.acl_account[account] = title;}); break;
}
}
if(!there)
{
sel_options.acl_account = new Array().concat(sel_options.acl_account);
this.egw.link_title('home-accounts', content.acl_account, function(title) {sel_options.acl_account.push({value: content.acl_account, label: title});});
}
} }
if(content.acl_location) if(content.acl_location)
{ {