Only one server call for automatic switch to accounts addressbook or all addressbooks dependin…

…g on distribution list is a group
This commit is contained in:
nathangray 2017-01-24 08:43:57 -07:00
parent 768b6ae861
commit 2d645afc17
2 changed files with 14 additions and 6 deletions

View File

@ -240,7 +240,7 @@ class addressbook_ui extends addressbook_bo
'business_adr_one_countrycode_adr_one_postalcode,tel_work_tel_cell_tel_home,url_email_email_home', 'business_adr_one_countrycode_adr_one_postalcode,tel_work_tel_cell_tel_home,url_email_email_home',
/* old negative list /* old negative list
'default_cols' => '!cat_id,contact_created_contact_modified,distribution_list,contact_id,owner,room',*/ 'default_cols' => '!cat_id,contact_created_contact_modified,distribution_list,contact_id,owner,room',*/
'filter2_onchange' => "app.addressbook.filter2_onchange();", 'filter2_onchange' => "return app.addressbook.filter2_onchange();",
'manual' => $do_email ? ' ' : false, // space for the manual icon 'manual' => $do_email ? ' ' : false, // space for the manual icon
//'actions' => $this->get_actions(), // set on each request, as it depends on some filters //'actions' => $this->get_actions(), // set on each request, as it depends on some filters
'row_id' => 'id', 'row_id' => 'id',

View File

@ -666,16 +666,24 @@ app.classes.addressbook = AppJS.extend(
var widget = this.et2.getWidgetById('nm'); var widget = this.et2.getWidgetById('nm');
var filter2_val = filter2.get_value(); var filter2_val = filter2.get_value();
// automatic switch to accounts addressbook or all addressbooks depending on distribution list is a group
if (filter2_val && (filter2_val < 0) !== (filter.get_value() === '0'))
{
filter.set_value(filter2_val < 0 ? '0' : '');
}
if(filter2_val == 'add') if(filter2_val == 'add')
{ {
this.add_new_list(typeof widget == 'undefined' ? this.et2.getWidgetById('filter').value : widget.header.filter.get_value()); this.add_new_list(typeof widget == 'undefined' ? this.et2.getWidgetById('filter').value : widget.header.filter.get_value());
this.value=''; this.value='';
} }
// automatic switch to accounts addressbook or all addressbooks depending on distribution list is a group
else if (filter2_val && (filter2_val < 0) !== (filter.get_value() === '0'))
{
// Change filter & filter2 at the same time
widget.applyFilters({
filter: filter2_val < 0 ? '0' : '',
filter2: filter2_val
});
// Don't get rows here, let applyFilters() do it
return false;
}
return true;
}, },
/** /**