--- \\lssapiw01\c$\Inetpub\MantisTest\\..\MantisStandard\return_dynamic_filters.php 2005-06-04 17:39:28.000000000 +0200 +++ \\lssapiw01\c$\Inetpub\MantisTest\return_dynamic_filters.php 2005-07-19 17:02:51.988529800 +0200 @@ -40,7 +40,12 @@ if ( ON == config_get( 'filter_by_custom_fields' ) ) { $t_custom_cols = config_get( 'filter_custom_fields_per_row' ); + /* PATCH Custom fields should not appear more than one in filter */ + /* $t_custom_fields = custom_field_get_linked_ids( $t_project_id ); + */ + $t_custom_fields = custom_field_get_all_unique_linked_ids( $t_project_id ); + /* PATCH Custom fields should not appear more than one in filter */ foreach ( $t_custom_fields as $t_cfid ) { $t_field_info = custom_field_cache_row( $t_cfid, true ); --- \\lssapiw01\c$\Inetpub\MantisTest\\..\MantisStandard\view_filters_page.php 2005-06-13 14:05:43.397658600 +0200 +++ \\lssapiw01\c$\Inetpub\MantisTest\view_filters_page.php 2005-07-19 17:02:57.004122700 +0200 @@ -87,7 +87,12 @@ if ( ON == config_get( 'filter_by_custom_fields' ) ) { $t_custom_cols = $t_filter_cols; + /* PATCH Custom fields should not appear more than one in filter */ + /* $t_custom_fields = custom_field_get_linked_ids( $t_project_id ); + */ + $t_custom_fields = custom_field_get_all_unique_linked_ids( $t_project_id ); + /* PATCH Custom fields should not appear more than one in filter */ foreach ( $t_custom_fields as $t_cfid ) { $t_field_info = custom_field_cache_row( $t_cfid, true ); --- \\lssapiw01\c$\Inetpub\MantisStandard\core\custom_field_api.php 2005-07-18 13:48:58.193484400 +0200 +++ \\lssapiw01\c$\Inetpub\MantisTest\core\custom_field_api.php 2005-07-19 17:11:40.016400400 +0200 @@ -664,6 +664,28 @@ return $t_ids; } + /* PATCH Unique list of linked custom fields */ + # -------------------- + # Return an array of UNIQUE ids of custom fields bound to the specified project and subproject + # + # The ids will be sorted based on the sequence number associated with the binding + function custom_field_get_all_unique_linked_ids( $p_project_id = ALL_PROJECTS ) { + + if ( ALL_PROJECTS == $p_project_id ) { + $t_ids = custom_field_get_linked_ids( $p_project_id ); + } else { + # Build an array of projects + $t_project_ids = user_get_all_accessible_subprojects( auth_get_current_user_id(), $p_project_id ); + array_unshift( $t_project_ids, $p_project_id ); + $t_ids = custom_field_get_linked_ids( $t_project_ids ); + } + + #remove duplicates from array + $t_unique_ids = array_unique($t_ids) ; + + return $t_unique_ids; + } + /* PATCH Unique list of linked custom fields */ # -------------------- # Return an array all custom field ids sorted by name function custom_field_get_ids( ) { --- \\lssapiw01\c$\Inetpub\MantisStandard\core\filter_api.php 2005-07-19 09:36:29.464776500 +0200 +++ \\lssapiw01\c$\Inetpub\MantisTest\core\filter_api.php 2005-07-19 17:03:56.566241500 +0200 @@ -592,7 +592,12 @@ # custom field filters if( ON == config_get( 'filter_by_custom_fields' ) ) { # custom field filtering + /* PATCH Custom fields should not appear more than one in filter */ + /* $t_custom_fields = custom_field_get_linked_ids( $t_project_id ); + */ + $t_custom_fields = custom_field_get_all_unique_linked_ids( $t_project_id ); + /* PATCH Custom fields should not appear more than one in filter */ foreach( $t_custom_fields as $t_cfid ) { $t_first_time = true; @@ -1008,7 +1013,12 @@ $t_per_row = 0; if ( ON == config_get( 'filter_by_custom_fields' ) ) { + /* PATCH Custom fields should not appear more than one in filter */ + /* $t_custom_fields = custom_field_get_linked_ids( $t_project_id ); + */ + $t_custom_fields = custom_field_get_all_unique_linked_ids( $t_project_id ); + /* PATCH Custom fields should not appear more than one in filter */ foreach ( $t_custom_fields as $t_cfid ) { $t_field_info = custom_field_cache_row( $t_cfid, true );