View Issue Details

IDProjectCategoryView StatusLast Update
0006042mantisbtfilterspublic2017-01-31 04:02
ReporternuclearspikeAssigned Tocproensa 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version1.0.0rc1 
Target Version2.1.0Fixed in Version2.1.0 
Summary0006042: Switching to "Advanced Filters" hides "Hide Status" and ignores setting
Description

If you have a list of issues where you are hiding resolved and above, then switch to advanced, the option to change the "Hide Status" parameter disappears and it shows all issues.

While I understand that the advanced version of "Status" and "Hide Status" have conflicts (since you could potentially select to show a status that was higher than "Hide Status"), it is a little unusual that switching causes a requery without the status limit -- though all other filters remain.

A possible solution: Ex: If you are set to hide Resolved and Above, when you switch to Advanced, have the Status options preset multiselected all status codes under Resolved.

Another option is to just allow it to remain on the filters view (as a single drop down) and if people choose conflicting options, it's their own decision.

Tagspatch

Relationships

has duplicate 0008597 closed Hide Status is not honored for Permalinks and Advanced Filters 
has duplicate 0008117 closed Wrong data in "Create Permlink" 
has duplicate 0007582 closed Hide Status filter applies randomly 
has duplicate 0007459 closedatrol Switching to "Advanced Filters" 
related to 0012664 confirmed hide_status_id in permalink not working 
child of 0021935 closedcproensa Filter api refactoring, manage stored filters 

Activities

morganparry

morganparry

2006-08-17 08:14

reporter   ~0013286

Last edited: 2006-08-17 09:51

I've just fixed this problem in our local Mantis installation (based on 1.0.5).

Firstly I had to fix a secondary issue where some code wasn't properly respecting the ADVANCED_ONLY or ADVANCED_DEFAULT settings for $g_view_filters. I made filter_ensure_valid_filter() force $p_filter_arr['_view_type'] to the right value in the case of ADVANCED_ONLY or SIMPLE_ONLY and then to use the right default if that array element wasn't set (where previously it just always used simple).

Once this was done, I changed a few places in the code to remove most of the differentiation between the simple and advanced filter views. For us the only difference is now that you can select multiple filters from the lists when using advanced view. The 'hide status' filter is available in both. I resolved the conflict between 'show status' and 'hide status' by adding some code in filter_ensure_valid_filter() to force $p_filter_arr['hide_status'] to META_FILTER_NONE if $p_filter_arr['show_status'] was not META_FILTER_ANY, ie. basically 'show status' takes priority. I then also added some code in filter_get_bug_rows() to deal with 'hide status' in the advanced case.

I can probably supply a patch, if that would be helpful.

Random praise: thanks for everyone's work on Mantis. We run a very slightly customised 1.0.5 installation here that currently has 30,000 bugs and 50,000 bugnotes in 70 projects with 300 users and it's great. Using certain other non-free packages is often painful in comparison.

giallu

giallu

2007-07-17 04:22

reporter   ~0015076

I'd appreciate if you could provide your patch for this issue, preferably using the guildelines here:

http://www.mantisbt.org/wiki/doku.php/mantisbt:howto_submit_patches

2007-07-17 05:08

 

filter_api.patch (9,243 bytes)
--- core/filter_api.php	2006/08/17 13:23:33
+++ core/filter_api.php	2006/08/02 12:25:25
@@ -341,47 +341,16 @@
 				$t_desired_statuses[] = $t_this_status;
 			}
 		} else {
-			# advanced filtering: same as simple above except that 'show_status' may be
-            # set to a list of statuses
+			# advanced filtering: ignore the hide
 			$t_any_found = false;
 			foreach( $t_filter['show_status'] as $t_this_status ) {
 				$t_desired_statuses[] = $t_this_status;
 				if ( ( META_FILTER_ANY == $t_this_status ) || ( is_blank( $t_this_status ) ) || ( 0 === $t_this_status ) ) {
 					$t_any_found = true;
-                    break;
 				}
 			}
-			if( $t_any_found ) {
+			if ( $t_any_found ) {
 				$t_desired_statuses = array();
-                
-                # Filter by 'hide_status' list, if necessary.
-                if( count($t_filter['hide_status']) > 0 && !in_array(META_FILTER_NONE, $t_filter['hide_status']) ) {
-                    if( count($t_filter['hide_status']) > 1 ) {
-                        # Specifically filter out these ones.
-                        foreach( $t_available_statuses as $t_this_available_status ) {
-                            if( !in_array($t_this_available_status, $t_filter['hide_status']) ) {
-                                $t_desired_statuses[] = $t_this_available_status;
-                            }
-                        }
-                    } else {
-                        # Filter out anything >= the single status listed.
-                        $t_status_cutoff = $t_filter['hide_status'][0];
-                        foreach( $t_available_statuses as $t_this_available_status ) {
-                            if( $t_this_available_status < $t_status_cutoff ) {
-                                $t_desired_statuses[] = $t_this_available_status;
-                            }
-                        }
-                    }
-                    
-                    # If this filters out all statuses then ensure we don't
-                    # end up showing everything below. While this is
-                    # technically user error, it would probably just be more
-                    # confusing for this case to be equivalent to where
-                    # show_status=any and hide_status=none.
-                    if( !count($t_desired_statuses) ) {
-                        $t_desired_statuses[] = META_FILTER_NONE;
-                    }
-                }
 			}
 		}
 
@@ -1380,7 +1349,9 @@
 				<a href="<?php PRINT $t_filters_url . 'show_status[]'; ?>" id="show_status_filter"><?php PRINT lang_get( 'status' ) ?>:</a>
 			</td>
 			<td class="small-caption" valign="top">
-                <a href="<?php PRINT $t_filters_url . 'hide_status[]'; ?>" id="hide_status_filter"><?php PRINT lang_get( 'hide_status' ) ?>:</a>
+				<?php if ( 'simple' == $t_view_type ) { ?>
+					<a href="<?php PRINT $t_filters_url . 'hide_status[]'; ?>" id="hide_status_filter"><?php PRINT lang_get( 'hide_status' ) ?>:</a>
+				<?php } ?>
 			</td>
 			<td class="small-caption" valign="top">
 				<a href="<?php PRINT $t_filters_url . 'show_build[]'; ?>" id="show_build_filter"><?php PRINT lang_get( 'product_build' ) ?>:</a>
@@ -1444,39 +1415,41 @@
 			</td>
 			<td class="small-caption" valign="top" id="hide_status_filter_target">
 							<?php
-                                $t_output = '';
-                                $t_none_found = false;
-                                if ( count( $t_filter['hide_status'] ) == 0 ) {
-                                    PRINT lang_get( 'none' );
-                                } else {
-                                    $t_first_flag = true;
-                                    foreach( $t_filter['hide_status'] as $t_current ) {
-                                        ?>
-                                        <input type="hidden" name="hide_status[]" value="<?php echo $t_current;?>" />
-                                        <?php
-                                        $t_this_string = '';
-                                        if ( ( $t_current == META_FILTER_NONE ) || ( is_blank( $t_current ) ) || ( $t_current === 0 ) ) {
-                                            $t_none_found = true;
-                                        } else {
-                                            $t_this_string = get_enum_element( 'status', $t_current );
-                                        }
-                                        if ( $t_first_flag != true ) {
-                                            $t_output = $t_output . '<br />';
-                                        } else {
-                                            $t_first_flag = false;
-                                        }
-                                        $t_output = $t_output . $t_this_string;
-                                    }
-                                    $t_hide_status_post = '';
-                                    if ( count( $t_filter['hide_status'] ) == 1 ) {
-                                        $t_hide_status_post = ' (' . lang_get( 'and_above' ) . ')';
-                                    }
-                                    if ( true == $t_none_found ) {
-                                        PRINT lang_get( 'none' );
-                                    } else {
-                                        PRINT $t_output . $t_hide_status_post;
-                                    }
-                                }
+								if ( 'simple' == $t_view_type ) {
+									$t_output = '';
+									$t_none_found = false;
+									if ( count( $t_filter['hide_status'] ) == 0 ) {
+										PRINT lang_get( 'none' );
+									} else {
+										$t_first_flag = true;
+										foreach( $t_filter['hide_status'] as $t_current ) {
+											?>
+											<input type="hidden" name="hide_status[]" value="<?php echo $t_current;?>" />
+											<?php
+											$t_this_string = '';
+											if ( ( $t_current == META_FILTER_NONE ) || ( is_blank( $t_current ) ) || ( $t_current === 0 ) ) {
+												$t_none_found = true;
+											} else {
+												$t_this_string = get_enum_element( 'status', $t_current );
+											}
+											if ( $t_first_flag != true ) {
+												$t_output = $t_output . '<br />';
+											} else {
+												$t_first_flag = false;
+											}
+											$t_output = $t_output . $t_this_string;
+										}
+										$t_hide_status_post = '';
+										if ( count( $t_filter['hide_status'] ) == 1 ) {
+											$t_hide_status_post = ' (' . lang_get( 'and_above' ) . ')';
+										}
+										if ( true == $t_none_found ) {
+											PRINT lang_get( 'none' );
+										} else {
+											PRINT $t_output . $t_hide_status_post;
+										}
+									}
+								}
 							?>
 			</td>
 			<td class="small-caption" valign="top" id="show_build_filter_target">
@@ -2364,19 +2337,9 @@
 		if ( substr( config_get( 'cookie_version' ), 1 ) > $t_cookie_vers ) { # if the version is old, update it
 			$p_filter_arr['_version'] = config_get( 'cookie_version' );
 		}
-        
-        $t_view_filters_setting = config_get( 'view_filters' );
-        $t_default_view_type = ( ADVANCED_ONLY == $t_view_filters_setting || ADVANCED_DEFAULT == $t_view_filters_setting ? 'advanced' : 'simple' );
-        # If config restricts view type to a particular one, just force that
-        # in all cases.
-        if( ADVANCED_ONLY == $t_view_filters_setting || SIMPLE_ONLY == $t_view_filters_setting ) {
-            $p_filter_arr['_view_type'] = $t_default_view_type;
-        }
-        # Otherwise just set to default if not already set.
-		elseif( !isset( $p_filter_arr['_view_type'] ) ) {
-			$p_filter_arr['_view_type'] = gpc_get_string( 'view_type', $t_default_view_type );
+		if ( !isset( $p_filter_arr['_view_type'] ) ) {
+			$p_filter_arr['_view_type'] = gpc_get_string( 'view_type', 'simple' );
 		}
-        
 		if ( !isset( $p_filter_arr['per_page'] ) ) {
 			$p_filter_arr['per_page'] = gpc_get_int( 'per_page', config_get( 'default_limit_view' ) );
 		}
@@ -2554,23 +2517,6 @@
 				}
 			}
 		}
-        
-        # Deal with conflicting settings for 'show status' and 'hide status'.
-        # The former takes priority and if it's set to anything except 'any'
-        # then 'hide status' can't be used.
-        $t_show_status_is_any = false;
-        $t_num_to_check = ( 'simple' == $p_filter_arr['_view_type'] ? 1 : count($p_filter_arr['show_status']) );
-        for( $i = 0; $i < $t_num_to_check; $i++ ) {
-            $t_this_status =  $p_filter_arr['show_status'][$i];
-            if( META_FILTER_ANY == $t_this_status || is_blank($t_this_status) || 0 === $t_this_status ) {
-                $t_show_status_is_any = true;
-                break;
-            }
-        }
-        if( !$t_show_status_is_any ) {
-            $p_filter_arr['hide_status'] = array( META_FILTER_NONE );
-        }
-        
 		# all of our filter values are now guaranteed to be there, and correct.
 		return $p_filter_arr;
 	}
filter_api.patch (9,243 bytes)

2007-07-17 05:08

 

view_filters_page.patch (1,389 bytes)
--- view_filters_page.php	2006/08/17 13:23:33
+++ view_filters_page.php	2006/08/02 12:25:25
@@ -36,7 +36,12 @@
 			<?php
 			global $t_target_field;
 			if ( $t_target_field ) {
-                print "field_to_focus = \"$t_target_field\";";
+				$f_view_type = gpc_get_string( 'view_type', '' );
+				if ( ( 'hide_status[]' == $t_target_field ) && ( 'advanced' == $f_view_type ) ) {
+					print "field_to_focus = \"show_status[]\";";
+				} else {
+					print "field_to_focus = \"$t_target_field\";";
+				}
 			} else {
 				print "field_to_focus = null;";
 			}
@@ -220,7 +225,11 @@
 	<td class="small-caption" colspan="<?php echo ( 1 * $t_custom_cols ); ?>"><?php echo lang_get( 'status' ) ?></td>
 	<td class="small-caption" colspan="<?php echo ( 1 * $t_custom_cols ); ?>">
 	<?php
-    echo lang_get( 'hide_status' );
+	if ( 'simple' == $f_view_type ) {
+		echo lang_get( 'hide_status' );
+	} else {
+		echo '&nbsp;';
+	}
 	?>
 	</td>
 	<td class="small-caption" colspan="<?php echo ( 1 * $t_custom_cols ); ?>"><?php echo lang_get( 'product_build' ) ?></td>
@@ -242,7 +251,11 @@
 	<!-- Hide Status -->
 	<td valign="top" colspan="<?php echo ( 1 * $t_custom_cols ); ?>">
 	<?php
-    print_filter_hide_status();
+	if ( 'simple' == $f_view_type ) {
+		print_filter_hide_status();
+	} else {
+		echo '&nbsp;';
+	}
 	?>
 	</td>
 	<!-- Build -->
view_filters_page.patch (1,389 bytes)
morganparry

morganparry

2007-07-17 05:08

reporter   ~0015078

I've attached some patches against 1.0.5. I realise this isn't entirely in-keeping with your patch guidelines but it's all I have time to do, I'm afraid. I hope it's of some use.

wyrfel

wyrfel

2010-11-10 02:22

reporter  

view_all_set.patch (1,022 bytes)
--- ./view_all_set.php	2010-09-14 14:40:10.000000000 +1000
+++ ../../Development/Mentor/mantis/view_all_set.php	2010-11-10 17:53:08.000000000 +1100
@@ -106,6 +106,21 @@
 		$f_hide_status = array( $f_hide_status );
 	}
 
+	if ($f_view_type == 'advanced') {
+		# advanced filtering: remove all stati above or equal the lowest selected hide status value from the show status list
+		sort($f_hide_status);
+		if (count($f_hide_status) && $f_hide_status[0] > 1) {
+			$t_show_status = (filter_field_is_any($f_show_status)) ? MantisEnum::getValues( config_get( 'status_enum_string' ) ) : $f_show_status;
+			$f_show_status = array();
+			foreach( $t_show_status as $t_this_show_status ) {
+				if( $t_this_show_status < $f_hide_status[0] ) {
+					$f_show_status[] = $t_this_show_status;
+				}
+			}
+			$f_hide_status = array();
+		}
+	}
+
 	$f_reporter_id = array();
 	if ( is_array( gpc_get( FILTER_PROPERTY_REPORTER_ID, null ) ) ) {
 		$f_reporter_id = gpc_get_string_array( FILTER_PROPERTY_REPORTER_ID, META_FILTER_ANY );
view_all_set.patch (1,022 bytes)
wyrfel

wyrfel

2010-11-10 02:32

reporter   ~0027319

I've had the same/similar problem with 1.2.3 .

I switched our installation to always use Advanced Filters, with the result that the filter links from the 'My View' page ignored the 'hide status' setting, so that the resulting list on the 'View Issues' page for instance for the 'Assigned to me (Unresolved)' link did include resolved and closed ones.

My fix (attached as view_all_set.patch) does the following:
1) check if filtering is advanced, and if so...
2) check if hide_status is set and if so...
3) get the lowest selected 'hide status'
4) if 'show status' is 'any', make it equivalent 'available stati', then
5) remove all stati from 'show status' that are equal or higher than lowest 'hide status'
6) clear 'hide status'

This 'converts' any hide status setting into 'show status' settings on advanced filtering. It also results in proper population of the 'status' filter setting field on page load, so that subsequently the status filter can be further narrowed or expanded.

I'm not sure if this is a complete solution, but it seems to work pretty well, here.

Sorry i don't have an SVN copy, but i guess this part of code hasn't really changed, yet?

wyrfel

wyrfel

2010-11-10 03:36

reporter  

filter_api_2.patch (3,073 bytes)
--- core/filter_api.php	2010-09-14 14:40:10.000000000 +1000
+++ core/filter_api.php	2010-11-10 19:16:30.000000000 +1100
@@ -449,9 +449,25 @@ function filter_ensure_valid_filter( $p_
 		# if the version is old, update it
 		$p_filter_arr['_version'] = config_get( 'cookie_version' );
 	}
+
+	# validate filter type
+	$t_default_view_type = 'simple';
+	if ( ADVANCED_DEFAULT == config_get( 'view_filters' ) ) {
+		$t_default_view_type = 'advanced';
+	}
 	if( !isset( $p_filter_arr['_view_type'] ) ) {
-		$p_filter_arr['_view_type'] = gpc_get_string( 'view_type', 'simple' );
+		$p_filter_arr['_view_type'] = gpc_get_string( 'view_type', $t_default_view_type );
+	}
+
+	if ( ADVANCED_ONLY == config_get( 'view_filters' ) ) {
+		$p_filter_arr['_view_type'] = 'advanced';
+	} else if ( SIMPLE_ONLY == config_get( 'view_filters' ) ) {
+		$p_filter_arr['_view_type'] = 'simple';
+	}
+	if ( !in_array( $p_filter_arr['_view_type'], array( 'simple', 'advanced' ) ) ) {
+		$p_filter_arr['_view_type'] = $t_default_view_type;
 	}
+
 	if( !isset( $p_filter_arr[FILTER_PROPERTY_ISSUES_PER_PAGE] ) ) {
 		$p_filter_arr[FILTER_PROPERTY_ISSUES_PER_PAGE] = gpc_get_int( FILTER_PROPERTY_ISSUES_PER_PAGE, config_get( 'default_limit_view' ) );
 	}
@@ -696,6 +712,22 @@ function filter_ensure_valid_filter( $p_
 		}
 	}
 
+	if ($p_filter_arr['_view_type'] == 'advanced' && count($p_filter_arr[FILTER_PROPERTY_HIDE_STATUS_ID])) {
+		# advanced filtering: remove all stati above or equal the lowest selected hide status value from the show status list
+		$t_hide_status = $p_filter_arr[FILTER_PROPERTY_HIDE_STATUS_ID];
+		sort($t_hide_status);
+		if ($t_hide_status[0] > 1) {
+			$t_show_status = (filter_field_is_any($p_filter_arr[FILTER_PROPERTY_STATUS_ID])) ? MantisEnum::getValues( config_get( 'status_enum_string' ) ) : $p_filter_arr[FILTER_PROPERTY_STATUS_ID];
+			$p_filter_arr[FILTER_PROPERTY_STATUS_ID] = array();
+			foreach( $t_show_status as $t_this_show_status ) {
+				if( $t_this_show_status < $t_hide_status[0] ) {
+					$p_filter_arr[FILTER_PROPERTY_STATUS_ID][] = $t_this_show_status;
+				}
+			}
+			$p_filter_arr[FILTER_PROPERTY_HIDE_STATUS_ID] = array();
+		}
+	}
+
 	if( is_array( $t_custom_fields ) && ( count( $t_custom_fields ) > 0 ) ) {
 		foreach( $t_custom_fields as $t_cfid ) {
 			if( !isset( $p_filter_arr['custom_fields'][$t_cfid] ) ) {
@@ -1352,13 +1384,13 @@ function filter_get_bug_rows( &$p_page_n
 	# the ones we want shown are still available
 	$t_desired_statuses = array();
 	$t_available_statuses = MantisEnum::getValues( config_get( 'status_enum_string' ) );
+	$t_this_hide_status = $t_filter[FILTER_PROPERTY_HIDE_STATUS_ID][0];
 
 	if( 'simple' == $t_filter['_view_type'] ) {
 
 		# simple filtering: if showing any, restrict by the hide status value, otherwise ignore the hide
 		$t_any_found = false;
 		$t_this_status = $t_filter[FILTER_PROPERTY_STATUS_ID][0];
-		$t_this_hide_status = $t_filter[FILTER_PROPERTY_HIDE_STATUS_ID][0];
 
 		if( filter_field_is_any( $t_this_status ) ) {
 			foreach( $t_available_statuses as $t_this_available_status ) {
filter_api_2.patch (3,073 bytes)
wyrfel

wyrfel

2010-11-10 03:38

reporter   ~0027320

Ok, the first approach was a bit crappy since it got ignored in a couple of places.

So i moved the routine into filter_ensure_valid_filter() and added 'view_type' validation there as well, which was missing.

Not 100% sure if this plays 100% nicely with the filter caching, but it works better than the first approach.

wyrfel

wyrfel

2010-11-10 03:42

reporter   ~0027321

So basically now you have a choice between Morgan's "always show 'hide status' and have 'show status' take precedence" approach or my "translate 'hide status' into 'show status' on advanced filtering" approach.

I personally prefer mine as i think 'hide status' is not really discoverable for uninitiated users and having both creates inconsistencies that need explanation.

Morgans approach has the advantage, though, that the 'hide status' property doesn't get lost when switching between simple and advanced filters.

wyrfel

wyrfel

2010-11-10 03:45

reporter   ~0027322

Sorry for note-spamming, but i also want to say that this issue is probably a little more major than 'minor', as it leads to faulty filter results when using advanced filtering and clicking the links from the 'My View' page.

dominik

dominik

2011-09-22 09:24

reporter  

fixForHideStatusOnAdvancedFilterPage-1.2.x.patch (6,785 bytes)
From 3ac08e57ecc54245cb0901f5bb9de63b8d2c679d Mon Sep 17 00:00:00 2001
From: Dominik Blunk <dominik@blunk.ch>
Date: Thu, 22 Sep 2011 15:15:06 +0200
Subject: [PATCH] Fixed: "Hide status" is lost when working with "advanced filters"

@see http://www.mantisbt.org/bugs/view.php?id=6042

- Field "hide status" is shown on both filter pages (simple and advanced)
- "Hide status" is only considered when "show status" is (contains) ANY
- "Hide status" is set to NONE when "show status" is not ANY
- "Hide status" on advanced filter page does only consider selected values
  (while simple filter does consider status AND ABOVE)
---
 core/filter_api.php |   52 ++++++++++++++++++++++++++++++++++++--------------
 view_all_set.php    |   12 +++++-----
 2 files changed, 43 insertions(+), 21 deletions(-)

diff --git a/core/filter_api.php b/core/filter_api.php
index 27a8807..b50c217 100644
--- a/core/filter_api.php
+++ b/core/filter_api.php
@@ -445,12 +445,26 @@ function filter_ensure_valid_filter( $p_filter_arr ) {
 	}
 	$t_cookie_vers = (int) utf8_substr( $p_filter_arr['_version'], 1 );
 	if( utf8_substr( config_get( 'cookie_version' ), 1 ) > $t_cookie_vers ) {
-
 		# if the version is old, update it
 		$p_filter_arr['_version'] = config_get( 'cookie_version' );
 	}
 	if( !isset( $p_filter_arr['_view_type'] ) ) {
-		$p_filter_arr['_view_type'] = gpc_get_string( 'view_type', 'simple' );
+		$p_filter_arr['_view_type'] = gpc_get_string( 'view_type', null );
+		if ( empty( $p_filter_arr['_view_type'] ) ) {
+			$t_view_filters_setting = config_get( 'view_filters' );
+			$t_default_view_type = ( ADVANCED_ONLY == $t_view_filters_setting || ADVANCED_DEFAULT == $t_view_filters_setting ? 'advanced' : 'simple' );
+			# If config restricts view type to a particular one, just force that for all cases
+			if( ADVANCED_ONLY == $t_view_filters_setting || SIMPLE_ONLY == $t_view_filters_setting ) {
+				$p_filter_arr['_view_type'] = $t_default_view_type;
+			}
+			# Otherwise just set to default if not already set.
+			else if( !isset( $p_filter_arr['_view_type'] ) ) {
+				$p_filter_arr['_view_type'] = gpc_get_string( 'view_type', $t_default_view_type );
+			}
+			if ( !isset( $p_filter_arr['_view_type'] ) ) {
+				$p_filter_arr['_view_type'] = gpc_get_string( 'view_type', 'simple' );
+	 		}
+		}
 	}
 	if( !isset( $p_filter_arr[FILTER_PROPERTY_ISSUES_PER_PAGE] ) ) {
 		$p_filter_arr[FILTER_PROPERTY_ISSUES_PER_PAGE] = gpc_get_int( FILTER_PROPERTY_ISSUES_PER_PAGE, config_get( 'default_limit_view' ) );
@@ -720,6 +734,11 @@ function filter_ensure_valid_filter( $p_filter_arr ) {
 			}
 		}
 	}
+	
+	# set hide_status to "none when show_status is not ANY
+	if ( !filter_field_is_any( $p_filter_arr['show_status'] ) ) {
+		$p_filter_arr['hide_status'] = array( META_FILTER_NONE );
+	}
 
 	# all of our filter values are now guaranteed to be there, and correct.
 	return $p_filter_arr;
@@ -1370,12 +1389,20 @@ function filter_get_bug_rows( &$p_page_number, &$p_per_page, &$p_page_count, &$p
 			$t_desired_statuses[] = $t_this_status;
 		}
 	} else {
-		# advanced filtering: ignore the hide
+		# advanced filtering: if showing any, restrict by the hide status value, otherwise ignore the hide
 		if( filter_field_is_any( $t_filter[FILTER_PROPERTY_STATUS_ID] ) ) {
-			$t_desired_statuses = array();
-		} else {
-			foreach( $t_filter[FILTER_PROPERTY_STATUS_ID] as $t_this_status ) {
-				$t_desired_statuses[] = $t_this_status;
+			foreach( $t_filter[FILTER_PROPERTY_HIDE_STATUS_ID] as $t_this_hide_status ) {
+				$t_this_hide_statuses[] = $t_this_hide_status;
+			}
+			foreach( $t_available_statuses as $t_this_available_status ) {
+				if( !in_array( $t_this_available_status, $t_this_hide_statuses ) ) {
+					$t_desired_statuses[] = $t_this_available_status;
+				}
+			}
+		}
+		else {
+			foreach( $t_filter[FILTER_PROPERTY_STATUS_ID] as $t_this_show_status ) {
+				$t_desired_statuses[] = $t_this_show_status;
 			}
 		}
 	}
@@ -2449,10 +2476,7 @@ function filter_draw_selection_area2( $p_page_number, $p_for_screen = true, $p_e
 				<a href="<?php echo $t_filters_url . FILTER_PROPERTY_STATUS_ID . '[]';?>" id="show_status_filter"><?php echo lang_get( 'status' )?>:</a>
 			</td>
 			<td class="small-caption" valign="top">
-				<?php if( 'simple' == $t_view_type ) {?>
-					<a href="<?php echo $t_filters_url . FILTER_PROPERTY_HIDE_STATUS_ID . '[]';?>" id="hide_status_filter"><?php echo lang_get( 'hide_status' )?>:</a>
-				<?php
-		}?>
+				<a href="<?php echo $t_filters_url . FILTER_PROPERTY_HIDE_STATUS_ID . '[]';?>" id="hide_status_filter"><?php echo lang_get( 'hide_status' )?>:</a>
 			</td>
 			<td class="small-caption" valign="top">
 			<?php if ( $t_show_build ) { ?>
@@ -2523,8 +2547,7 @@ function filter_draw_selection_area2( $p_page_number, $p_for_screen = true, $p_e
 		?>
 			</td>
 			<td class="small-caption" valign="top" id="hide_status_filter_target">
-							<?php
-								if( 'simple' == $t_view_type ) {
+		<?php
 			$t_output = '';
 			$t_none_found = false;
 			if( count( $t_filter[FILTER_PROPERTY_HIDE_STATUS_ID] ) == 0 ) {
@@ -2547,7 +2570,7 @@ function filter_draw_selection_area2( $p_page_number, $p_for_screen = true, $p_e
 					$t_output = $t_output . string_display_line( $t_this_string );
 				}
 				$t_hide_status_post = '';
-				if( count( $t_filter[FILTER_PROPERTY_HIDE_STATUS_ID] ) == 1 ) {
+				if( count( $t_filter[FILTER_PROPERTY_HIDE_STATUS_ID] ) == 1 && $t_view_type == 'simple' ) {
 					$t_hide_status_post = ' (' . lang_get( 'and_above' ) . ')';
 				}
 				if( true == $t_none_found ) {
@@ -2556,7 +2579,6 @@ function filter_draw_selection_area2( $p_page_number, $p_for_screen = true, $p_e
 					echo $t_output . string_display_line( $t_hide_status_post );
 				}
 			}
-		}
 		?>
 			</td>
 			<?php if ( $t_show_build ) { ?>
diff --git a/view_all_set.php b/view_all_set.php
index 950e48d..7a608b3 100644
--- a/view_all_set.php
+++ b/view_all_set.php
@@ -195,12 +195,12 @@
 	}
 
 	$f_note_user_id = array();
-    if ( is_array( gpc_get( FILTER_PROPERTY_NOTE_USER_ID, null ) ) ) {
-        $f_note_user_id = gpc_get_string_array( FILTER_PROPERTY_NOTE_USER_ID, META_FILTER_ANY );
-    } else {
-        $f_note_user_id = gpc_get_string( FILTER_PROPERTY_NOTE_USER_ID, META_FILTER_ANY );
-        $f_note_user_id = array( $f_note_user_id );
-    }
+	if ( is_array( gpc_get( FILTER_PROPERTY_NOTE_USER_ID, null ) ) ) {
+		$f_note_user_id = gpc_get_string_array( FILTER_PROPERTY_NOTE_USER_ID, META_FILTER_ANY );
+	} else {
+		$f_note_user_id = gpc_get_string( FILTER_PROPERTY_NOTE_USER_ID, META_FILTER_ANY );
+		$f_note_user_id = array( $f_note_user_id );
+	}
 
 	# these are only single values, even when doing advanced filtering
 	$f_per_page				= gpc_get_int( FILTER_PROPERTY_ISSUES_PER_PAGE, -1 );
-- 
1.7.4.msysgit.0

dominik

dominik

2011-09-22 09:25

reporter   ~0029837

Added patch against Master-1.2.x which is based upon morgans patch/idea of always displaying the "hide status" field...

dominik

dominik

2011-09-26 04:17

reporter  

fixForHideStatusOnAdvancedFilterPageV2.0-1.2.x.patch (8,730 bytes)
From 3ac08e57ecc54245cb0901f5bb9de63b8d2c679d Mon Sep 17 00:00:00 2001
From: Dominik Blunk <dominik@blunk.ch>
Date: Thu, 22 Sep 2011 15:15:06 +0200
Subject: [PATCH 1/2] Fixed: "Hide status" is lost when working with "advanced filters"

@see http://www.mantisbt.org/bugs/view.php?id=6042

- Field "hide status" is shown on both filter pages (simple and advanced)
- "Hide status" is only considered when "show status" is (contains) ANY
- "Hide status" is set to NONE when "show status" is not ANY
- "Hide status" on advanced filter page does only consider selected values
  (while simple filter does consider status AND ABOVE)
---
 core/filter_api.php |   52 ++++++++++++++++++++++++++++++++++++--------------
 view_all_set.php    |   12 +++++-----
 2 files changed, 43 insertions(+), 21 deletions(-)

diff --git a/core/filter_api.php b/core/filter_api.php
index 27a8807..b50c217 100644
--- a/core/filter_api.php
+++ b/core/filter_api.php
@@ -445,12 +445,26 @@ function filter_ensure_valid_filter( $p_filter_arr ) {
 	}
 	$t_cookie_vers = (int) utf8_substr( $p_filter_arr['_version'], 1 );
 	if( utf8_substr( config_get( 'cookie_version' ), 1 ) > $t_cookie_vers ) {
-
 		# if the version is old, update it
 		$p_filter_arr['_version'] = config_get( 'cookie_version' );
 	}
 	if( !isset( $p_filter_arr['_view_type'] ) ) {
-		$p_filter_arr['_view_type'] = gpc_get_string( 'view_type', 'simple' );
+		$p_filter_arr['_view_type'] = gpc_get_string( 'view_type', null );
+		if ( empty( $p_filter_arr['_view_type'] ) ) {
+			$t_view_filters_setting = config_get( 'view_filters' );
+			$t_default_view_type = ( ADVANCED_ONLY == $t_view_filters_setting || ADVANCED_DEFAULT == $t_view_filters_setting ? 'advanced' : 'simple' );
+			# If config restricts view type to a particular one, just force that for all cases
+			if( ADVANCED_ONLY == $t_view_filters_setting || SIMPLE_ONLY == $t_view_filters_setting ) {
+				$p_filter_arr['_view_type'] = $t_default_view_type;
+			}
+			# Otherwise just set to default if not already set.
+			else if( !isset( $p_filter_arr['_view_type'] ) ) {
+				$p_filter_arr['_view_type'] = gpc_get_string( 'view_type', $t_default_view_type );
+			}
+			if ( !isset( $p_filter_arr['_view_type'] ) ) {
+				$p_filter_arr['_view_type'] = gpc_get_string( 'view_type', 'simple' );
+	 		}
+		}
 	}
 	if( !isset( $p_filter_arr[FILTER_PROPERTY_ISSUES_PER_PAGE] ) ) {
 		$p_filter_arr[FILTER_PROPERTY_ISSUES_PER_PAGE] = gpc_get_int( FILTER_PROPERTY_ISSUES_PER_PAGE, config_get( 'default_limit_view' ) );
@@ -720,6 +734,11 @@ function filter_ensure_valid_filter( $p_filter_arr ) {
 			}
 		}
 	}
+	
+	# set hide_status to "none when show_status is not ANY
+	if ( !filter_field_is_any( $p_filter_arr['show_status'] ) ) {
+		$p_filter_arr['hide_status'] = array( META_FILTER_NONE );
+	}
 
 	# all of our filter values are now guaranteed to be there, and correct.
 	return $p_filter_arr;
@@ -1370,12 +1389,20 @@ function filter_get_bug_rows( &$p_page_number, &$p_per_page, &$p_page_count, &$p
 			$t_desired_statuses[] = $t_this_status;
 		}
 	} else {
-		# advanced filtering: ignore the hide
+		# advanced filtering: if showing any, restrict by the hide status value, otherwise ignore the hide
 		if( filter_field_is_any( $t_filter[FILTER_PROPERTY_STATUS_ID] ) ) {
-			$t_desired_statuses = array();
-		} else {
-			foreach( $t_filter[FILTER_PROPERTY_STATUS_ID] as $t_this_status ) {
-				$t_desired_statuses[] = $t_this_status;
+			foreach( $t_filter[FILTER_PROPERTY_HIDE_STATUS_ID] as $t_this_hide_status ) {
+				$t_this_hide_statuses[] = $t_this_hide_status;
+			}
+			foreach( $t_available_statuses as $t_this_available_status ) {
+				if( !in_array( $t_this_available_status, $t_this_hide_statuses ) ) {
+					$t_desired_statuses[] = $t_this_available_status;
+				}
+			}
+		}
+		else {
+			foreach( $t_filter[FILTER_PROPERTY_STATUS_ID] as $t_this_show_status ) {
+				$t_desired_statuses[] = $t_this_show_status;
 			}
 		}
 	}
@@ -2449,10 +2476,7 @@ function filter_draw_selection_area2( $p_page_number, $p_for_screen = true, $p_e
 				<a href="<?php echo $t_filters_url . FILTER_PROPERTY_STATUS_ID . '[]';?>" id="show_status_filter"><?php echo lang_get( 'status' )?>:</a>
 			</td>
 			<td class="small-caption" valign="top">
-				<?php if( 'simple' == $t_view_type ) {?>
-					<a href="<?php echo $t_filters_url . FILTER_PROPERTY_HIDE_STATUS_ID . '[]';?>" id="hide_status_filter"><?php echo lang_get( 'hide_status' )?>:</a>
-				<?php
-		}?>
+				<a href="<?php echo $t_filters_url . FILTER_PROPERTY_HIDE_STATUS_ID . '[]';?>" id="hide_status_filter"><?php echo lang_get( 'hide_status' )?>:</a>
 			</td>
 			<td class="small-caption" valign="top">
 			<?php if ( $t_show_build ) { ?>
@@ -2523,8 +2547,7 @@ function filter_draw_selection_area2( $p_page_number, $p_for_screen = true, $p_e
 		?>
 			</td>
 			<td class="small-caption" valign="top" id="hide_status_filter_target">
-							<?php
-								if( 'simple' == $t_view_type ) {
+		<?php
 			$t_output = '';
 			$t_none_found = false;
 			if( count( $t_filter[FILTER_PROPERTY_HIDE_STATUS_ID] ) == 0 ) {
@@ -2547,7 +2570,7 @@ function filter_draw_selection_area2( $p_page_number, $p_for_screen = true, $p_e
 					$t_output = $t_output . string_display_line( $t_this_string );
 				}
 				$t_hide_status_post = '';
-				if( count( $t_filter[FILTER_PROPERTY_HIDE_STATUS_ID] ) == 1 ) {
+				if( count( $t_filter[FILTER_PROPERTY_HIDE_STATUS_ID] ) == 1 && $t_view_type == 'simple' ) {
 					$t_hide_status_post = ' (' . lang_get( 'and_above' ) . ')';
 				}
 				if( true == $t_none_found ) {
@@ -2556,7 +2579,6 @@ function filter_draw_selection_area2( $p_page_number, $p_for_screen = true, $p_e
 					echo $t_output . string_display_line( $t_hide_status_post );
 				}
 			}
-		}
 		?>
 			</td>
 			<?php if ( $t_show_build ) { ?>
diff --git a/view_all_set.php b/view_all_set.php
index 950e48d..7a608b3 100644
--- a/view_all_set.php
+++ b/view_all_set.php
@@ -195,12 +195,12 @@
 	}
 
 	$f_note_user_id = array();
-    if ( is_array( gpc_get( FILTER_PROPERTY_NOTE_USER_ID, null ) ) ) {
-        $f_note_user_id = gpc_get_string_array( FILTER_PROPERTY_NOTE_USER_ID, META_FILTER_ANY );
-    } else {
-        $f_note_user_id = gpc_get_string( FILTER_PROPERTY_NOTE_USER_ID, META_FILTER_ANY );
-        $f_note_user_id = array( $f_note_user_id );
-    }
+	if ( is_array( gpc_get( FILTER_PROPERTY_NOTE_USER_ID, null ) ) ) {
+		$f_note_user_id = gpc_get_string_array( FILTER_PROPERTY_NOTE_USER_ID, META_FILTER_ANY );
+	} else {
+		$f_note_user_id = gpc_get_string( FILTER_PROPERTY_NOTE_USER_ID, META_FILTER_ANY );
+		$f_note_user_id = array( $f_note_user_id );
+	}
 
 	# these are only single values, even when doing advanced filtering
 	$f_per_page				= gpc_get_int( FILTER_PROPERTY_ISSUES_PER_PAGE, -1 );
-- 
1.7.4.msysgit.0


From 7ee08fcc9e574b524fd055a0d8ad0de3ea01d288 Mon Sep 17 00:00:00 2001
From: Dominik Blunk <dominik@blunk.ch>
Date: Mon, 26 Sep 2011 09:59:58 +0200
Subject: [PATCH 2/2] When using advanced filters hide status "resolved" AND "closed" for section "assigned (unresolved)" on "my view" page

---
 my_view_inc.php |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/my_view_inc.php b/my_view_inc.php
index 1120901..1aaa909 100644
--- a/my_view_inc.php
+++ b/my_view_inc.php
@@ -47,12 +47,15 @@ if( $t_filter === false ) {
 	$t_filter = filter_get_default();
 }
 
+$t_view_filter_setting = config_get( 'view_filters' );
+
 $t_sort = $t_filter['sort'];
 $t_dir = $t_filter['dir'];
 
 $t_icon_path = config_get( 'icon_path' );
 $t_update_bug_threshold = config_get( 'update_bug_threshold' );
 $t_bug_resolved_status_threshold = config_get( 'bug_resolved_status_threshold' );
+$t_bug_closed_status_threshold = config_get( 'bug_closed_status_threshold' );
 $t_hide_status_default = config_get( 'hide_status_default' );
 $t_default_show_changed = config_get( 'default_show_changed' );
 
@@ -89,7 +92,12 @@ $c_filter['assigned'] = array(
 		'0' => META_FILTER_ANY,
 	),
 );
-$url_link_parameters['assigned'] = FILTER_PROPERTY_HANDLER_ID . '=' . $t_current_user_id . '&' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . $t_bug_resolved_status_threshold;
+$url_link_parameters['assigned'] = FILTER_PROPERTY_HANDLER_ID . '=' . $t_current_user_id . '&' . FILTER_PROPERTY_HIDE_STATUS_ID . '[]=' . $t_bug_resolved_status_threshold;
+
+if ( $t_view_filter_setting == ADVANCED_ONLY || $t_view_filter_setting == ADVANCED_DEFAULT ) {
+	$c_filter['assigned'][FILTER_PROPERTY_HIDE_STATUS_ID][] = $t_bug_closed_status_threshold;
+	$url_link_parameters['assigned'] .= '&' . FILTER_PROPERTY_HIDE_STATUS_ID . '[]=' . $t_bug_closed_status_threshold;
+}
 
 $c_filter['recent_mod'] = array(
 	FILTER_PROPERTY_CATEGORY => Array(
-- 
1.7.4.msysgit.0

atrol

atrol

2014-01-21 16:06

developer   ~0039118

Unassigned after having been assigned for a long time without progress.

Issue History

Date Modified Username Field Change
2005-07-29 16:26 nuclearspike New Issue
2005-08-01 13:17 thraxisp Status new => confirmed
2005-08-01 13:17 thraxisp Relationship added child of 0004181
2006-08-17 08:14 morganparry Note Added: 0013286
2006-08-17 09:51 morganparry Note Edited: 0013286
2007-07-17 04:22 giallu Note Added: 0015076
2007-07-17 04:23 giallu Target Version => 1.1.0
2007-07-17 04:27 giallu Relationship deleted child of 0004181
2007-07-17 05:08 morganparry File Added: filter_api.patch
2007-07-17 05:08 morganparry File Added: view_filters_page.patch
2007-07-17 05:08 morganparry Note Added: 0015078
2007-11-21 13:37 jreese Relationship added has duplicate 0008597
2008-01-14 10:11 vboctor Target Version 1.1.1 => 1.1.x
2008-08-05 10:33 jreese Target Version 1.1.x => 1.1.3
2008-08-05 20:49 daryn Status confirmed => assigned
2008-08-05 20:49 daryn Assigned To => daryn
2008-08-05 21:15 daryn Relationship added has duplicate 0008117
2008-08-12 14:12 daryn Relationship added has duplicate 0007582
2009-01-29 17:19 polzin Tag Attached: patch
2010-08-18 16:01 atrol Relationship added has duplicate 0007459
2010-11-10 02:22 wyrfel File Added: view_all_set.patch
2010-11-10 02:32 wyrfel Note Added: 0027319
2010-11-10 03:36 wyrfel File Added: filter_api_2.patch
2010-11-10 03:38 wyrfel Note Added: 0027320
2010-11-10 03:42 wyrfel Note Added: 0027321
2010-11-10 03:45 wyrfel Note Added: 0027322
2011-01-07 09:08 atrol Relationship added related to 0012664
2011-08-14 11:50 atrol Target Version 1.1.3 => 1.3.0-beta.1
2011-09-22 09:24 dominik File Added: fixForHideStatusOnAdvancedFilterPage-1.2.x.patch
2011-09-22 09:25 dominik Note Added: 0029837
2011-09-26 04:17 dominik File Added: fixForHideStatusOnAdvancedFilterPageV2.0-1.2.x.patch
2014-01-21 16:06 atrol Note Added: 0039118
2014-01-21 16:06 atrol Assigned To daryn =>
2014-01-21 16:06 atrol Status assigned => confirmed
2014-01-21 16:06 atrol Target Version 1.3.0-beta.1 =>
2016-10-20 03:38 cproensa Assigned To => cproensa
2016-10-20 03:38 cproensa Status confirmed => assigned
2016-11-20 16:07 cproensa Relationship added child of 0021935
2017-01-14 17:48 cproensa Status assigned => resolved
2017-01-14 17:48 cproensa Resolution open => fixed
2017-01-14 17:48 cproensa Fixed in Version => 2.1.0
2017-01-14 17:48 cproensa Target Version => 2.1.0
2017-01-31 04:02 vboctor Status resolved => closed