Skip to content

Commit

Permalink
Make sure we print something when user does not exist
Browse files Browse the repository at this point in the history
Kind of a corner case, but if the user being added to the selection list
no longer exists, then the ID is added but the name is printed as an
empty string, resulting in incorrect behavior (the first empty string is
selected, so when record is saved the field is set to blank).

Follow-up fix for issue #19574
  • Loading branch information
dregad committed Apr 20, 2015
1 parent feb65ad commit aa70e11
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion core/print_api.php
Expand Up @@ -303,7 +303,17 @@ function print_user_option_list( $p_user_id, $p_project_id = null, $p_access = A
$p_user_id != NO_USER &&
!array_key_exists( $p_user_id, $t_users )
) {
$t_users[$p_user_id] = user_get_row( $p_user_id );
$t_row = user_get_row( $p_user_id );
if( $t_row === false ) {
# User doesn't exist - create a dummy record for display purposes
$t_name = user_get_name( $p_user_id );
$t_row = array(
'id' => $p_user_id,
'username' => $t_name,
'realname' => $t_name,
);
}
$t_users[$p_user_id] = $t_row;
}

$t_display = array();
Expand Down

0 comments on commit aa70e11

Please sign in to comment.