* Addressbook - Fix favorites that included a selected organisation did not get correctly applied

This commit is contained in:
nathangray 2017-07-26 15:06:47 -06:00
parent efe9478d84
commit a3d010f5b0

View File

@ -951,14 +951,14 @@ app.classes.addressbook = AppJS.extend(
},this).sendRequest(true); },this).sendRequest(true);
return false; 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) // Deal with grouped views that are not valid (not in list of options)
// by faking viewing that organisation // by faking viewing that organisation
var index = etemplate2.getById('addressbook-index'); var index = etemplate2.getById('addressbook-index');
if(index && index.widgetContainer) if(index && index.widgetContainer)
{ {
var grouped = index.widgetContainer.getWidgetById('grouped_view'); var grouped = index.widgetContainer.getWidgetById('org_view');
var options = false; var options = false;
if(grouped && grouped.options && grouped.options.select_options) 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 // Check to see if it's not there
if(options && (options.find && if(options && (options.find &&
!grouped.options.select_options.find(function(e) {console.log(e); return e.value === state.state.grouped_view;}) || !options.find(function(e) {console.log(e); return e.value === state.state.org_view;}) ||
!options[state.state.grouped_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 nm = index.widgetContainer.getWidgetById('nm');
var action = nm.controller._actionManager.getActionById('view_org'); var action = nm.controller._actionManager.getActionById('view_org');
var senders = [{_context: {_widget: nm}}]; 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]});
} }
} }
} }