From 3dfc697c7cb097debcc9fe83ae0d0aa4b189f9a9 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Mon, 14 Dec 2015 18:38:53 +0000 Subject: [PATCH] Fix missing participant names in sidebox & listview --- calendar/js/app.js | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/calendar/js/app.js b/calendar/js/app.js index e825d18c82..f1ca32c4ce 100644 --- a/calendar/js/app.js +++ b/calendar/js/app.js @@ -1845,7 +1845,7 @@ app.classes.calendar = AppJS.extend( } } var value = [{start_date: state.state.first, end_date: state.state.last}]; - if(state.state.view !== 'listview') this._need_data(value,state.state); + this._need_data(value,state.state); } // Include first & last dates in state, mostly for server side processing if(state.state.first && state.state.first.toJSON) state.state.first = state.state.first.toJSON(); @@ -2383,21 +2383,41 @@ app.classes.calendar = AppJS.extend( // Merge in new, update label of existing for(var i in data.rows.sel_options[field]) { + var found = false; var option = data.rows.sel_options[field][i]; for(var j in widget.options.select_options) { if(option.value == widget.options.select_options[j].value) { widget.options.select_options[j].label = option.label; + found = true; break; } - + } + if(!found) + { + widget.options.select_options.push(option); } } var in_progress = app.calendar.state_update_in_progress; app.calendar.state_update_in_progress = true; widget.set_select_options(widget.options.select_options); widget.set_value(widget.getValue()); + + // If updating owner, update listview participants as well + // This lets us _add_ to the options, normal nm behaviour will replace. + if(field == 'owner') + { + try { + var participant = app.classes.calendar.views.listview.etemplates[0].widgetContainer.getWidgetById('nm').getWidgetById('participant'); + if(participant) + { + participant.options.select_options = widget.options.select_options; + participant.set_select_options(widget.options.select_options); + } + } catch(e) {debugger;} + } + app.calendar.state_update_in_progress = in_progress; } }