View Issue Details

IDProjectCategoryView StatusLast Update
0008821mantisbtfilterspublic2009-01-15 11:25
Reporterskygeex Assigned Todaryn  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
OSWindows Vista Home 
Product Version1.1.0 
Target Version1.2.0a3Fixed in Version1.2.0a3 
Summary0008821: Filtering on tags not quite working
Description

When specifying a tag name in a filter for a search, the filter is not properly applied, and all issues still come up in the search, not just those assigned the selected tag, as expected.

Steps To Reproduce

1) Go to View Issues
2) Expand the Filter panel (make sure filters are Reset)
3) Click Tags: link, select an existing Tag
4) Click Apply Filter

Notice that issues not assigned the selected tag appear in the search results.

Additional Information

A tag filter does operate properly if you enter anything into the Search: field prior to applying the tag filter. If you then back out whetever was typed into the Search: field and apply the tag filter again, it still works. But without typing something to the Search: field, filtering on tags doesn't work right. This operates contrary to all other filter parameter settings, where a Search term is not necessary to performing a proper filtered search (i.e. filtering on Status returns search results that include only those with the selected status).

TagsNo tags attached.
Attached Files
8821.patch (1,031 bytes)   
Index: filter_api.php
===================================================================
--- filter_api.php	(revision 5752)
+++ filter_api.php	(working copy)
@@ -1680,9 +1680,16 @@
 
 	# tags
 	$c_tag_string = trim( $t_filter[FILTER_PROPERTY_TAG_STRING] );
+	//RH @EC #8821
+	$c_tag_select = trim( $t_filter[FILTER_PROPERTY_TAG_SELECT] );
+	if(is_blank( $c_tag_string ) and !is_blank($c_tag_select))
+	{
+		$t = tag_get($c_tag_select); $c_tag_string = $t['name'];
+	}
+	//End of RH @EC #8821
 	if( !is_blank( $c_tag_string ) ) {
 		$t_tags = tag_parse_filters( $c_tag_string );
-
+		
 		if( count( $t_tags ) ) {
 
 			$t_tags_all = array();
@@ -1733,6 +1740,7 @@
 				array_push( $t_where_clauses, "$t_bug_table.id NOT IN ( SELECT bug_id FROM $t_bug_tag_table WHERE ( " . implode( ' OR ', $t_clauses ) . ') )' );
 			}
 		}
+
 	}
 
 	# note user id
@@ -2895,6 +2903,7 @@
 		}
 		PRINT $t_tag_string;
 		echo '<input type="hidden" name="', FILTER_PROPERTY_TAG_STRING, '" value="', $t_tag_string, '" />';
+
 		?>
 			</td>
 		</tr>
8821.patch (1,031 bytes)   
8821_new.patch (1,054 bytes)   
Index: filter_api.php
===================================================================
--- filter_api.php	(revision 5752)
+++ filter_api.php	(working copy)
@@ -1680,9 +1680,16 @@
 
 	# tags
 	$c_tag_string = trim( $t_filter[FILTER_PROPERTY_TAG_STRING] );
+	//RH @EC #8821
+	$c_tag_select = trim( $t_filter[FILTER_PROPERTY_TAG_SELECT] );
+	if(is_blank( $c_tag_string ) and !is_blank($c_tag_select) and $c_tag_select != 0)
+	{
+		$t = tag_get($c_tag_select); $c_tag_string = $t['name'];
+	}
+	//End of RH @EC #8821
 	if( !is_blank( $c_tag_string ) ) {
 		$t_tags = tag_parse_filters( $c_tag_string );
-
+		
 		if( count( $t_tags ) ) {
 
 			$t_tags_all = array();
@@ -1733,6 +1740,7 @@
 				array_push( $t_where_clauses, "$t_bug_table.id NOT IN ( SELECT bug_id FROM $t_bug_tag_table WHERE ( " . implode( ' OR ', $t_clauses ) . ') )' );
 			}
 		}
+
 	}
 
 	# note user id
@@ -2895,6 +2903,7 @@
 		}
 		PRINT $t_tag_string;
 		echo '<input type="hidden" name="', FILTER_PROPERTY_TAG_STRING, '" value="', $t_tag_string, '" />';
+
 		?>
 			</td>
 		</tr>
8821_new.patch (1,054 bytes)   

Activities

motobass

motobass

2008-07-11 12:58

reporter   ~0018372

Related issue with tag filtering in version 1.1.2 is that if more than one tag is entered for the filter, it does not limit issues to only those having all the tags in the filter. I imagine that would be the desired behavior.

grangeway

grangeway

2008-07-15 15:26

reporter   ~0018555

Daryn, can you look at this?

Paul

skygeex

skygeex

2008-08-04 12:49

reporter   ~0019023

Target Version changed from 1.2.0a2 to 1.2.x. Please forgive the question, but does this indicate that a fix is being deferred to some unspecified future target?

daryn

daryn

2008-08-04 13:53

reporter   ~0019028

yes. 1.2.0a2 was released today and due to some other priorities I was unable to complete this fix in time. 1.2.x means it is being targeted for the next release of the 1.2 codestream which would presumably be 1.2.0a3. This is an alpha release so the issue here 'should' be fixed in time for the 1.2.0 stable release.

rhurtik

rhurtik

2008-12-23 12:05

reporter   ~0020475

I've tried to reproduce the error on svn revision 5752 as described in summary of this issue. The only problem I've noticed is that I have to Click on Apply Filter two times to get it work. On the second submit filter works fine and only “tagged” tickets appears in the output.

skygeex

skygeex

2008-12-23 15:41

reporter   ~0020477

You are correct. This is another functional variation of the same issue. Clicking Apply Filter the first time yields non-filtered results (more issues than only those with the selected tag), and clicking Apply Filter a second time returns satisfactory results (only issues with the selected tag). It appears possible that the contents of the Search: field is irrelevant. The summary for the issue should be refined as having to click Apply Filter twice to get Tag filtering to work.

rhurtik

rhurtik

2008-12-29 10:21

reporter   ~0020497

Last edited: 2008-12-29 12:14

core/filter.api Line 1683.
Condition if( !is_blank( $c_tag_string ) ) evaluate presence of a tag in the text box.

Obviously on the first submit when mantis extract the “ tag_string” from data base is the text box empty and filter doesn't work.

Instead of tag string I propose evaluate the tag id from drop down menu. The id is always present in the post array so this approach should solve the problem.

The attached patch fix the issue.
Let me know if the solution suits you.

rhurtik

rhurtik

2008-12-29 10:42

reporter   ~0020498

Last edited: 2008-12-29 12:12

A fix for conditional statement . Please use the 8821_new.patch .

daryn

daryn

2008-12-31 10:14

reporter   ~0020507

Applied patch with some formatting modifications. See revision http://git.mantisbt.org/?p=mantisbt.git;a=commitdiff;h=61a03a37c0a46fa2d56f3d1209d138f074cc7d84

ghohm

ghohm

2009-01-05 05:31

reporter   ~0020537

Version 1.1.2 (without the patch mentioned above): This bug doesn't appear with Firefox 3.0.x, only with Internet Explorer 6.

skygeex

skygeex

2009-01-05 12:58

reporter   ~0020543

FYI: You are correct, Firefox 3.0.x does not exhibit this issue, even in Mantis 1.1.0. The issue was originally encountered in Internet Explorer 7, so the problem did exist there, as well, prior to this patch. Glad it's resolved.

Related Changesets

MantisBT: master 61a03a37

2008-12-31 10:10

daryn


Details Diff
Fix for bug 0008821, Filtering on tags not quite working Affected Issues
0008821
mod - core/filter_api.php Diff File