Addressbook - Duplicate view - Fix a bug with types, add some debug to help with long queries.

This commit is contained in:
nathangray 2017-03-17 10:01:23 -06:00
parent 27922446d7
commit d5386625d5
2 changed files with 8 additions and 5 deletions

View File

@ -209,7 +209,7 @@ class addressbook_hooks
'values' => $duplicate_options,
'help' => 'Fields to consider when looking for duplicate contacts.',
'admin' => false,
'default' => 'n_family, n_given, org_name, contact_email'
'default' => 'n_family, org_name, contact_email'
);
$settings['duplicate_threshold'] = array(
'type' => 'input',

View File

@ -285,10 +285,11 @@ class Sql extends Api\Storage
$join .= str_replace('cat_id', 'a2.cat_id', $cat_filter) . ' AND ';
unset($filter['cat_id']);
}
if ($param['col_filter']['tid'])
if ($filter['tid'])
{
$filter['contact_tid'] = $param['col_filter']['tid'];
$join .= 'a2.contact_tid = ' . $this->db->quote($filter['contact_tid']) . ' AND ';
$filter[$this->table_name . '.contact_tid'] = $param['col_filter']['tid'];
$join .= 'a2.contact_tid = ' . $this->db->quote($filter['tid']) . ' AND ';
unset($filter['tid']);
}
else
{
@ -331,7 +332,7 @@ class Sql extends Api\Storage
$sort = $param['sort'] == 'DESC' ? 'DESC' : 'ASC';
$group = $GLOBALS['egw_info']['user']['preferences']['addressbook']['duplicate_fields'] ?
explode(',',$GLOBALS['egw_info']['user']['preferences']['addressbook']['duplicate_fields']):
array('n_family', 'n_given', 'org_name', 'contact_email');
array('n_family', 'org_name', 'contact_email');
$match_count = $GLOBALS['egw_info']['user']['preferences']['addressbook']['duplicate_threshold'] ?
$GLOBALS['egw_info']['user']['preferences']['addressbook']['duplicate_threshold'] : 3;
@ -374,6 +375,8 @@ class Sql extends Api\Storage
$join
);
error_log(__METHOD__ . ':'.__LINE__ . ' Subquery: ' . $sub_query);
$columns = implode(', ', $group);
if ($this->db->Type == 'mysql' && $this->db->ServerInfo['version'] >= 4.0)
{