Permalink
Browse files

Respect $g_show_realname setting in config report's filter userlist

The filter's original implementation displayed "Realname (username)" in
the user selection list. We now only retrieve the user id from the db,
and call user_get_name() to get either the realname or the username as
appropriate instead.

Issue #14559
  • Loading branch information...
1 parent 9f72490 commit efdd6a7538ae2366b1dadb52e85fc5d95ae80c1c @dregad dregad committed Dec 30, 2012
Showing with 14 additions and 11 deletions.
  1. +14 −11 adm_config_report.php
View
@@ -115,22 +115,25 @@ function print_option_list_from_array( $p_array, $p_filter_value ) {
# Apply filters
$t_config_table = db_get_table( 'mantis_config_table' );
- $t_user_table = db_get_table( 'mantis_user_table' );
$t_project_table = db_get_table( 'mantis_project_table' );
- # Get users in db with specific configs
- $query = "SELECT DISTINCT user_id, ut.realname as username, ut.username as idrh
- FROM $t_config_table as ct
- JOIN $t_user_table as ut ON ut.id = ct.user_id
- ORDER BY username";
- $t_result = db_query_bound( $query );
+ # Get users in db having specific configs
+ $query = "SELECT DISTINCT user_id
+ FROM $t_config_table
+ WHERE user_id <> " . db_param() ;
+ $t_result = db_query_bound( $query, array( ALL_USERS ) );
$t_users_list = array();
- $t_users_list[META_FILTER_NONE] = '[' . lang_get( 'any' ) . ']';
- $t_users_list[ALL_USERS] = lang_get( 'all_users' );
while ( $row = db_fetch_array( $t_result ) ) {
- extract( $row, EXTR_PREFIX_ALL, 'v' );
- $t_users_list[$v_user_id] = "$v_username ($v_idrh)";
+ $t_user_id = $row['user_id'];
+ $t_users_list[$t_user_id] = user_get_name( $t_user_id );
}
+ asort( $t_users_list );
+ # Prepend '[any]' and 'All Users' to the list
+ $t_users_list = array(
+ META_FILTER_NONE => '[' . lang_get( 'any' ) . ']',
+ ALL_USERS => lang_get( 'all_users' ),
+ )
+ + $t_users_list;
# Get projects in db with specific configs
$query = "SELECT DISTINCT project_id, pt.name as project_name

0 comments on commit efdd6a7

Please sign in to comment.