Prevent users in selected groups from showing up more than once

This commit is contained in:
Nathan Gray 2015-11-10 21:40:42 +00:00
parent 2d18c663b6
commit 9a1f24e3a4

View File

@ -342,6 +342,7 @@ var et2_calendar_planner = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResize
row_labels: function() { row_labels: function() {
var labels = []; var labels = [];
var accounts = egw.accounts(); var accounts = egw.accounts();
var already_added = [];
for(var i = 0; i < this.options.owner.length; i++) for(var i = 0; i < this.options.owner.length; i++)
{ {
var user = this.options.owner[i]; var user = this.options.owner[i];
@ -368,25 +369,34 @@ var et2_calendar_planner = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResize
row.set_label(name); row.set_label(name);
} }
},user); },user);
labels.push({id: user, label: label, data: {participants:user,owner:''}}); if(already_added.indexOf(user) < 0)
{
labels.push({id: user, label: label, data: {participants:user,owner:''}});
already_added.push(user);
}
} }
else if (user < 0) // groups else if (user < 0) // groups
{ {
egw.accountData(user,'account_fullname',true,function(result) { egw.accountData(user,'account_fullname',true,function(result) {
for(var id in result) for(var id in result)
{ {
this.push({id: id, label: result[id], data: {participants:id,owner:''}}); if(already_added.indexOf(id) < 0)
{
this.push({id: id, label: result[id], data: {participants:id,owner:''}});
already_added.push(id);
}
} }
},labels); },labels);
} }
else // users else // users
{ {
user = parseInt(user) user = parseInt(user)
for(var j = 0; j < accounts.length; j++) for(var j = 0; j < accounts.length && already_added.indexOf(user) < 0; j++)
{ {
if(accounts[j].value === user) if(accounts[j].value === user)
{ {
labels.push({id: user, label: accounts[j].label, data: {participants:user,owner:''}}); labels.push({id: user, label: accounts[j].label, data: {participants:user,owner:''}});
already_added.push(user);
break; break;
} }
} }