Navigation Menu

Skip to content

Commit

Permalink
Include custom fields from all included projects
Browse files Browse the repository at this point in the history
When retrieving custom fields to show in the filter form, evaluate all
projects included in the filter scope.
Previously, evaluation of subprojects only happened when filtering from
ALL_PROJECTS.

Additionally, check access level for the defined view threshold, to only
show those custom fields that are viewable by the user

Fixes: #5713, #23232
  • Loading branch information
cproensa authored and dregad committed Oct 7, 2017
1 parent 3016b8d commit b139b96
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions core/filter_form_api.php
Expand Up @@ -2631,11 +2631,14 @@ function filter_form_draw_inputs( $p_filter, $p_for_screen = true, $p_static = f
}

if( ON == config_get( 'filter_by_custom_fields' ) ) {
$t_custom_fields = custom_field_get_linked_ids( $t_project_id );
$t_filter_included_projects = filter_get_included_projects( $t_filter );
$t_custom_fields = custom_field_get_linked_ids( $t_filter_included_projects );
$t_accessible_custom_fields = array();
foreach( $t_custom_fields as $t_cfid ) {
$t_cfdef = custom_field_get_definition( $t_cfid );
if( $t_cfdef['access_level_r'] <= current_user_get_access_level() && $t_cfdef['filter_by'] ) {
$t_projects_to_check = array_intersect( $t_filter_included_projects, custom_field_get_project_ids( $t_cfid ) );
if( $t_cfdef['filter_by']
&& access_has_any_project_level( (int)$t_cfdef['access_level_r'], $t_projects_to_check ) ) {
$t_accessible_custom_fields[] = $t_cfdef;
}
}
Expand Down

0 comments on commit b139b96

Please sign in to comment.