Skip to content

Commit

Permalink
Status legend doesn't show final workflow states
Browse files Browse the repository at this point in the history
The patch for issue #11553 did not properly fix the problem, as the code
only checked for the workflow allowing to leave a state.

We now also cover the case of entering the state.

Fixes #20746
  • Loading branch information
dregad committed Mar 27, 2016
1 parent 272624e commit e18a9c2
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion core/html_api.php
Expand Up @@ -1390,10 +1390,21 @@ function html_status_legend( $p_display_position, $p_restrict_by_filter = false
$t_workflow = config_get( 'status_enum_workflow' );
if( !empty( $t_workflow ) ) {
foreach( $t_status_array as $t_status => $t_name ) {
# Check if the workflow allows leaving the state
if( !isset( $t_workflow[$t_status] ) ) {
# Check if the workflow allows entering the state
$t_can_enter = false;
foreach( $t_workflow as $t_values ) {
if( MantisEnum::hasValue( $t_values, $t_status ) ) {
$t_can_enter = true;
break;
}
}

# drop elements that are not in the workflow
unset( $t_status_array[$t_status] );
if( !$t_can_enter ) {
unset( $t_status_array[$t_status] );
}
}
}
}
Expand Down

0 comments on commit e18a9c2

Please sign in to comment.