From 188add767145719da1e3c005c75ee90fb62e8a3b Mon Sep 17 00:00:00 2001 From: nathangray Date: Mon, 20 Mar 2017 11:15:30 -0600 Subject: [PATCH] Addressbook - Fix adding a new distribution list with 'Select all' contacts would only add some contacts to the list. --- addressbook/js/app.js | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/addressbook/js/app.js b/addressbook/js/app.js index 648d4ba29d..42ceef8807 100644 --- a/addressbook/js/app.js +++ b/addressbook/js/app.js @@ -90,7 +90,7 @@ app.classes.addressbook = AppJS.extend( }); }, -/** + /** * Observer method receives update notifications from all applications * * App is responsible for only reacting to "messages" it is interested in! @@ -579,9 +579,17 @@ app.classes.addressbook = AppJS.extend( var filter = this.et2.getWidgetById('filter'); owner = filter.getValue()||egw.preference('add_default','addressbook'); } - var lists = this.et2.getWidgetById('filter2'); var contacts = []; - if(selected && selected.length) + if(selected && selected[0] && selected[0].getAllSelected()) + { + // All contacts selected, better ask the server for _all_ the IDs + fetchAll(selected, this.et2.getWidgetById('nm'), jQuery.proxy( + function(contacts) { + this._add_new_list_prompt(owner, contacts); + }, this)); + return; + } + else if(selected && selected.length) { for(var i = 0; i < selected.length; i++) { @@ -592,6 +600,19 @@ app.classes.addressbook = AppJS.extend( contacts.push(ids); } } + this._add_new_list_prompt(owner, contacts); + }, + + /** + * Ask the user for a name, then create a new list with the provided contacts + * in it. + * + * @param {int} owner + * @param {String[]} contacts + */ + _add_new_list_prompt: function(owner, contacts) + { + var lists = this.et2.getWidgetById('filter2'); et2_dialog.show_prompt( function(button, name) { if(button == et2_dialog.OK_BUTTON)