Commit c13d07f6 authored by Chris Graham's avatar Chris Graham

Fixed MANTIS-4232 (Filtercode on member CPF field_xxx syntax not working)

parent a0eb3b17
......@@ -43,8 +43,8 @@ function _members_filtercode($db, $info, $context, &$extra_join, &$extra_select,
return array($table_join_code . '.' . $filter_key, '', $field_val);
}
// CPFS...
// -------
// Mostly CPFS...
// --------------
$join_sql = ' LEFT JOIN ' . $db->get_table_prefix() . 'f_member_custom_fields f ON f.mf_member_id=r.id';
......@@ -54,8 +54,11 @@ function _members_filtercode($db, $info, $context, &$extra_join, &$extra_select,
$new_filter_key = $filter_key;
if (is_numeric($filter_key)) {
// CPF by just ID
$new_filter_key = 'field_' . $new_filter_key;
} elseif ($filter_key == 'gm_group_id') {
// Secondary usergroup membership
$join_sql = ' LEFT JOIN ' . $db->get_table_prefix() . 'f_group_members gm ON gm.gm_member_id=r.id';
if (!in_array($join_sql, $extra_join)) {
......@@ -64,6 +67,7 @@ function _members_filtercode($db, $info, $context, &$extra_join, &$extra_select,
return array($new_filter_key, '', $field_val);
} elseif (preg_match('#^field\_\d+$#', $filter_key) == 0) { // If it's not already correct
// CPF by title
require_code('cns_members');
$cpf_id = find_cpf_field_id($filter_key);
if (is_null($cpf_id)) {
......@@ -71,10 +75,8 @@ function _members_filtercode($db, $info, $context, &$extra_join, &$extra_select,
}
$new_filter_key = 'field_' . strval($cpf_id);
} else {
if (!array_key_exists($filter_key, $db_fields)) {
return null;
}
$new_filter_key = $table_join_code . '.' . $new_filter_key;
// CPF like field_xxx
$new_filter_key = $filter_key;
}
return array($new_filter_key, '', $field_val);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment