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 @@