fixed select-accounts show only part of users, caused by previously trying to extend now used array

This commit is contained in:
Ralf Becker 2014-05-07 15:51:45 +00:00
parent 354c030520
commit b111f5005b
2 changed files with 26 additions and 6 deletions

View File

@ -113,7 +113,27 @@ var et2_selectAccount = et2_selectbox.extend(
case 'selectbox':
case 'groupmembers':
default:
this.options.select_options = jQuery.extend({}, this.options.select_options, this.egw().accounts(this.options.account_type));
if (!jQuery.isArray(this.options.select_options))
{
var options = jQuery.extend({}, this.options.select_options);
this.options.select_options = [];
for(var key in options)
{
if (typeof options[key] == 'object')
{
if (typeof(options[key].key) == 'undefined')
{
options[key].value = key;
}
this.options.select_options.push(options[key]);
}
else
{
this.options.select_options.push({value: key, label: options});
}
}
}
this.options.select_options = this.options.select_options.concat(this.egw().accounts(this.options.account_type));
break;
}

View File

@ -81,13 +81,13 @@ egw.extend('user', egw.MODULE_GLOBAL, function()
* The list is filtered by type, one of 'accounts','groups','both', 'owngroups'
*
* @param {string} type
* @returns {Object}
* @returns {array}
*/
accounts: function(type)
{
if(typeof type == 'undefined') type = 'accounts';
var list = {};
var list = [];
if(jQuery.isEmptyObject(accountStore))
{
// Synchronous
@ -97,11 +97,11 @@ egw.extend('user', egw.MODULE_GLOBAL, function()
}
if(type == 'both')
{
list = jQuery.extend(list, accountStore['accounts'],accountStore['groups']);
list = list.concat(accountStore['accounts'], accountStore['groups']);
}
else
{
list = jQuery.extend(list, accountStore[type]);
list = list.concat(accountStore[type]);
}
return list;
}