* Addressbook - add filtering by distribution list for organisations

This commit is contained in:
nathangray 2018-07-19 14:54:05 -06:00
parent 26d8bd1cfb
commit 82ea4fe2de
2 changed files with 26 additions and 3 deletions

View File

@ -888,8 +888,6 @@ class addressbook_ui extends addressbook_bo
// Just switched from contact view, update actions
$query['actions'] = $this->get_actions($query['col_filter']['tid']);
}
unset($query['col_filter']['list']); // does not work together
$query['no_filter2'] = true; // switch the distribution list selection off
$query['template'] = $query['grouped_view'] == 'duplicates' ? 'addressbook.index.duplicate_rows' : 'addressbook.index.org_rows';
@ -912,9 +910,20 @@ class addressbook_ui extends addressbook_bo
$query['order'] = 'org_name';
}
$query['org_view'] = $query['grouped_view'];
$rows = parent::organisations($query);
// switch the distribution list selection off for ldap
if($this->contact_repository != 'sql')
{
$query['no_filter2'] = true;
unset($query['col_filter']['list']); // does not work here
}
else
{
$rows = parent::organisations($query);
}
break;
case 'addressbook.index.duplicate_rows':
$query['no_filter2'] = true; // switch the distribution list selection off
unset($query['col_filter']['list']); // does not work for duplicates
$rows = parent::duplicates($query);
break;
}

View File

@ -170,6 +170,20 @@ class Sql extends Api\Storage
{
$filter[] = "org_name != ''";// AND org_name IS NOT NULL";
}
if (isset($filter['list']))
{
if ($filter['list'] < 0)
{
$join .= " JOIN egw_acl ON $this->table_name.account_id=acl_account AND acl_appname='phpgw_group' AND ".
$this->db->expression('egw_acl', array('acl_location' => $filter['list']));
}
else
{
$join .= " JOIN $this->ab2list_table ON $this->table_name.contact_id=$this->ab2list_table.contact_id AND ".
$this->db->expression($this->ab2list_table, array('list_id' => $filter['list']));
}
unset($filter['list']);
}
$sort = $param['sort'] == 'DESC' ? 'DESC' : 'ASC';
list(,$by) = explode(',',$param['org_view']);