View Issue Details

IDProjectCategoryView StatusLast Update
0007710mantisbtfilterspublic2013-04-03 15:47
Reporterpolzin Assigned To 
PrioritynormalSeverityfeatureReproducibilityN/A
Status newResolutionopen 
Summary0007710: Patch for: Filter relationship with any (e.g. all issues with children)
Description

To get all issues with children:
1) Apply the patch (against 1.0.5).
2) View Issues
3) Filter: "child of" "0"
4) "Apply Filter"
5) Filter displays: "child of any"

TagsNo tags attached.
Attached Files
patch.txt (2,575 bytes)   
Index: core/filter_api.php
===================================================================
RCS file: /cvs/TPS/mantis/core/filter_api.php,v
retrieving revision 1.10
diff -u -r1.10 filter_api.php
--- core/filter_api.php	12 Oct 2006 11:45:43 -0000	1.10
+++ core/filter_api.php	10 Jan 2007 13:00:30 -0000
@@ -583,7 +583,7 @@
 		$t_any_found = false;
 		$c_rel_type = $t_filter['relationship_type'];
 		$c_rel_bug = $t_filter['relationship_bug'];
-		if ( -1 == $c_rel_type || 0 == $c_rel_bug) {
+		if ( -1 == $c_rel_type ) {
 			$t_any_found = true;
 		}
 		if ( !$t_any_found ) {
@@ -595,9 +595,19 @@
 			array_push( $t_join_clauses, "LEFT JOIN $t_bug_relationship_table $t_table_name ON $t_table_name.destination_bug_id = $t_bug_table.id" );
 			// get reverse relationships
 			if ( $c_rel_type == 1 ) array_push( $t_join_clauses, "LEFT JOIN $t_bug_relationship_table $t_table_name"."2 ON $t_table_name"."2.source_bug_id = $t_bug_table.id" );
- 			array_push( $t_clauses, "($t_table_name.relationship_type='$c_rel_type' AND $t_table_name.source_bug_id='$c_rel_bug')" );
- 			// get reverse relationships
-			if ( $c_rel_type == 1 ) array_push( $t_clauses, "($t_table_name"."2.relationship_type='$c_rel_type' AND $t_table_name"."2.destination_bug_id='$c_rel_bug')" );
+			if ( $c_rel_bug == 0 ) {
+				array_push( $t_clauses, "($t_table_name.relationship_type='$c_rel_type')" );
+			} else {
+				array_push( $t_clauses, "($t_table_name.relationship_type='$c_rel_type' AND $t_table_name.source_bug_id='$c_rel_bug')" );
+			}
+			// get reverse relationships
+			if ( $c_rel_type == 1 ) {
+				if ( $c_rel_bug == 0 ) {
+					array_push( $t_clauses, "($t_table_name"."2.relationship_type='$c_rel_type')" );
+				} else {
+					array_push( $t_clauses, "($t_table_name"."2.relationship_type='$c_rel_type' AND $t_table_name"."2.destination_bug_id='$c_rel_bug')" );
+				}
+			}
 			array_push( $t_where_clauses, '('. implode( ' OR ', $t_clauses ) .')' );
 		}
 
@@ -1747,10 +1757,15 @@
 							<?php
 								$c_rel_type = $t_filter['relationship_type'];
 								$c_rel_bug = $t_filter['relationship_bug'];
-								if ( -1 == $c_rel_type || 0 == $c_rel_bug ) {
+								if ( -1 == $c_rel_type ) {
 									PRINT lang_get( 'any' );
 								} else {
-								    PRINT relationship_get_description_for_history ($c_rel_type) . ' ' . $c_rel_bug;
+									PRINT relationship_get_description_for_history ($c_rel_type) . ' ';
+									if ( $c_rel_bug == 0 ) {
+										PRINT lang_get( 'any' );
+									} else {
+										PRINT $c_rel_bug;
+									}
 								}
 
 							?>
patch.txt (2,575 bytes)   

Relationships

has duplicate 0010799 closedatrol Relationship Filters 

Activities

olegos

olegos

2009-01-16 15:07

reporter   ~0020646

I'd like to see this feature implemented. Thanks.

ringgelerch

ringgelerch

2011-12-14 04:04

reporter   ~0030600

This feature would be very useful for me also.