Skip to content

Commit

Permalink
Custom field columns include subprojects fields
Browse files Browse the repository at this point in the history
Evaluate subprojects of current project to include readable custom
fields in the available columns list.
This allows adding a column for a custom field that is linked to a
subproject, which is the default behaviour when selecting ALL_PROJECTS.
Since columns are related to a project, but the filter by default shows
issues from subproject, extending the behaviour for any
project/subproject is consistent with the expectation that columns for
those custom fields can be used for view-all-bug page

Fixes: #23233
  • Loading branch information
cproensa authored and dregad committed Oct 7, 2017
1 parent 3476b16 commit fe444f1
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions core/columns_api.php
Original file line number Diff line number Diff line change
Expand Up @@ -252,15 +252,15 @@ function columns_get_all( $p_project_id = null ) {
} else {
$t_project_id = $p_project_id;
}

$t_related_custom_field_ids = custom_field_get_linked_ids( $t_project_id );
# Get custom fields from this project and sub-projects
$t_projects = user_get_all_accessible_projects( null, $t_project_id );
$t_related_custom_field_ids = custom_field_get_linked_ids( $t_projects );
foreach( $t_related_custom_field_ids as $t_id ) {
if( !custom_field_has_read_access_by_project_id( $t_id, $t_project_id ) ) {
continue;
$t_cfdef = custom_field_get_definition( $t_id );
$t_projects_to_check = array_intersect( $t_projects, custom_field_get_project_ids( $t_id ) );
if( access_has_any_project_level( (int)$t_cfdef['access_level_r'], $t_projects_to_check ) ) {
$t_columns[] = column_get_custom_field_column_name( $t_id );
}

$t_def = custom_field_get_definition( $t_id );
$t_columns[] = 'custom_' . $t_def['name'];
}

return $t_columns;
Expand Down

0 comments on commit fe444f1

Please sign in to comment.