Skip to content

Commit

Permalink
Show all users in assign filter when ALL PROJECTS is selected
Browse files Browse the repository at this point in the history
Fixes #10130

Signed-off-by: Damien Regad <damien.regad@merckgroup.com>
  • Loading branch information
JGuilbaud authored and dregad committed Dec 13, 2012
1 parent f92f1a0 commit 048dc22
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
2 changes: 1 addition & 1 deletion core/filter_api.php
Expand Up @@ -2218,7 +2218,7 @@ function filter_draw_selection_area2( $p_page_number, $p_for_screen = true, $p_e
$t_show_build = $t_show_product_version && ( config_get( 'enable_product_build' ) == ON );

# overload handler_id setting if user isn't supposed to see them (ref #6189)
if( !access_has_project_level( config_get( 'view_handler_threshold' ), $t_project_id ) ) {
if( !access_has_any_project( config_get( 'view_handler_threshold' ) ) ) {
$t_filter[FILTER_PROPERTY_HANDLER_ID] = array(
META_FILTER_ANY,
);
Expand Down
25 changes: 22 additions & 3 deletions core/print_api.php
Expand Up @@ -245,14 +245,33 @@ function print_captcha_input( $p_field_name ) {
# @todo from print_reporter_option_list
function print_user_option_list( $p_user_id, $p_project_id = null, $p_access = ANYBODY ) {
$t_users = array();

$t_users_temp = array();
if( null === $p_project_id ) {
$p_project_id = helper_get_current_project();
}

$t_users = project_get_all_user_rows( $p_project_id, $p_access );
if( $p_project_id === ALL_PROJECTS ) {
$t_projects = user_get_accessible_projects( auth_get_current_user_id() );
foreach( $t_projects as $t_project_id ){
$t_project_users_list = project_get_all_user_rows( $t_project_id, $p_access );
$t_users_temp = array_merge( $t_users_temp,$t_project_users_list );
}

$t_users_id_list = array();
# Remove current user from list (there is a "myself" value)
$t_users_id_list[] = auth_get_current_user_id();

# Deleting duplicate
foreach( $t_users_temp as $t_user ) {
if( !in_array($t_user['id'],$t_users_id_list ) ) {
$t_users_id_list[] = $t_user['id'];
$t_users[] = $t_user;
}
}
} else {
$t_users = project_get_all_user_rows( $p_project_id, $p_access );
}

# handles ALL_PROJECTS case

$t_display = array();
$t_sort = array();
Expand Down

0 comments on commit 048dc22

Please sign in to comment.