From 2e6dea62d6bfe41a499e76ac1d7ed130ebb545d8 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Mon, 24 Mar 2014 20:20:25 +0000 Subject: [PATCH] Fix some bugs in selectAccount with rows not set, but multiple on - Fix opening single select search dialog instead of multiple (cleared previous selection on OK) - Fix double user / groups in selected list --- etemplate/js/et2_widget_selectAccount.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/etemplate/js/et2_widget_selectAccount.js b/etemplate/js/et2_widget_selectAccount.js index 1ed522fe59..038a1414fa 100644 --- a/etemplate/js/et2_widget_selectAccount.js +++ b/etemplate/js/et2_widget_selectAccount.js @@ -113,7 +113,7 @@ var et2_selectAccount = et2_selectbox.extend( { var button = jQuery(document.createElement("span")) .addClass("et2_clickable") - .click(this, this._open_search) + .click(this, this.options.multiple ? this._open_multi_search : this._open_search) .attr("title", egw.lang("popup with search")) .append(''); @@ -308,10 +308,14 @@ var et2_selectAccount = et2_selectbox.extend( ids.push(id); // Make sure option is there - if(jQuery('input[id$="_opt_'+id+'"]',widget.multiOptions).length == 0) + if(!widget.options.multiple && jQuery('input[id$="_opt_'+id+'"]',widget.multiOptions).length == 0) { widget._appendMultiOption(id,jQuery('label',this).text()); } + else if (widget.options.multiple && jQuery('option[value="'+id+'"]',widget.node).length == 0) + { + widget._appendOptionElement(id,jQuery('label',this).text()); + } }); widget.set_value(ids); @@ -436,6 +440,9 @@ var et2_selectAccount = et2_selectbox.extend( var node = null; var self = this; + + // Make sure value is numeric + if(item.value) item.value = parseInt(item.value); // (containter of) Currently selected users / groups var selected = jQuery('#'+this.getInstanceManager().uniqueId + "_selected", this.dialog);