From a3d010f5b0d3c72ee9cc6035fa1c37c985879212 Mon Sep 17 00:00:00 2001 From: nathangray Date: Wed, 26 Jul 2017 15:06:47 -0600 Subject: [PATCH] * Addressbook - Fix favorites that included a selected organisation did not get correctly applied --- addressbook/js/app.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/addressbook/js/app.js b/addressbook/js/app.js index 9c00fbd644..ef4c05fa4c 100644 --- a/addressbook/js/app.js +++ b/addressbook/js/app.js @@ -951,14 +951,14 @@ app.classes.addressbook = AppJS.extend( },this).sendRequest(true); return false; } - else if (state.state.grouped_view) + else if (state.state.org_view) { // Deal with grouped views that are not valid (not in list of options) // by faking viewing that organisation var index = etemplate2.getById('addressbook-index'); if(index && index.widgetContainer) { - var grouped = index.widgetContainer.getWidgetById('grouped_view'); + var grouped = index.widgetContainer.getWidgetById('org_view'); var options = false; if(grouped && grouped.options && grouped.options.select_options) { @@ -967,14 +967,18 @@ app.classes.addressbook = AppJS.extend( // Check to see if it's not there if(options && (options.find && - !grouped.options.select_options.find(function(e) {console.log(e); return e.value === state.state.grouped_view;}) || - !options[state.state.grouped_view] + !options.find(function(e) {console.log(e); return e.value === state.state.org_view;}) || + typeof options.find === 'undefined' && !options[state.state.org_view] )) { + var senders = [{_context: {_widget: nm}}]; + window.setTimeout(function() { + app.addressbook.setState(state); + }, 500); var nm = index.widgetContainer.getWidgetById('nm'); var action = nm.controller._actionManager.getActionById('view_org'); var senders = [{_context: {_widget: nm}}]; - return nm_action(action, senders, {}, {ids:[state.state.grouped_view]}); + return nm_action(action, senders, {}, {ids:[state.state.org_view]}); } } }