diff --git a/core/html_api.php b/core/html_api.php index 61be4d4518..58072c8545 100644 --- a/core/html_api.php +++ b/core/html_api.php @@ -1369,20 +1369,11 @@ function html_button_bug_change_status( $p_bug_id ) { if( count( $t_enum_list ) > 0 ) { - # resort the list into ascending order + # resort the list into ascending order after noting the key from the first element (the default) + $t_default_arr = each( $t_enum_list ); + $t_default = $t_default_arr['key']; ksort( $t_enum_list ); - - # Get the default selected option as the next highest available status - # Otherwise fall back to using the last element in the array - end( $t_enum_list ); - $t_default = key( $t_enum_list ); reset( $t_enum_list ); - foreach( $t_enum_list as $key => $val ) { - if( $key > $t_bug_current_state ) { - $t_default = $key; - break; - } - } echo "
"; # CSRF protection not required here - form does not result in modifications