*** c:\Programme\webserver\Apache2\htdocs\Files\mantis\core\filter_api.php	Wed Mar  1 13:25:04 2006
--- c:\Downloads\mantis-1.0.1\mantis-1.0.1\core\filter_api.php	Sun Jan 29 13:59:48 2006
***************
*** 583,589 ****
  		$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 && BUG_NO_RELATION != $c_rel_type )) {
  			$t_any_found = true;
  		}
  		if ( !$t_any_found ) {
--- 583,589 ----
  		$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) {
  			$t_any_found = true;
  		}
  		if ( !$t_any_found ) {
***************
*** 592,618 ****
  			$t_clauses = array();
  			$t_table_name = 'relationship';
  			array_push( $t_from_clauses, $t_bug_relationship_table );
! 			# no relation
! 			if ($c_rel_type == BUG_NO_RELATION ) {
! 				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" );
! 				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.destination_bug_id IS NULL AND ". "$t_table_name"."2.source_bug_id IS NULL)" );
! 				# no relation to a specific bug
! 				if ($c_rel_bug != 0) {
! 					array_push( $t_clauses, "(($t_table_name.source_bug_id IS NULL     OR $t_table_name.source_bug_id != '$c_rel_bug') AND ".
! 											"($t_table_name.destination_bug_id IS NULL OR $t_table_name.destination_bug_id != '$c_rel_bug') AND ".
! 											"($t_table_name"."2.source_bug_id IS NULL OR $t_table_name"."2.source_bug_id != '$c_rel_bug') AND ".
! 											"($t_table_name"."2.destination_bug_id IS NULL OR $t_table_name"."2.destination_bug_id != '$c_rel_bug'))" );
! 				}
! 			# any relation
! 	 		} else {		
! 				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 == BUG_RELATED ) 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 == BUG_RELATED ) 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 ) .')' );
  		}
  
--- 592,603 ----
  			$t_clauses = array();
  			$t_table_name = 'relationship';
  			array_push( $t_from_clauses, $t_bug_relationship_table );
! 			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')" );
  			array_push( $t_where_clauses, '('. implode( ' OR ', $t_clauses ) .')' );
  		}
  
***************
*** 1748,1766 ****
  							}
  							?>
  			</td>
  			<td class="small-caption" valign="top" colspan="2" id="relationship_type_filter_target">
  							<input type="hidden" name="relationship_type" value="<?php echo $t_filter['relationship_type'];?>" />
  							<input type="hidden" name="relationship_bug" value="<?php echo $t_filter['relationship_bug'];?>" />
  							<?php
  								$c_rel_type = $t_filter['relationship_type'];
  								$c_rel_bug = $t_filter['relationship_bug'];
! 								if ( -1 == $c_rel_type || (0 == $c_rel_bug && BUG_NO_RELATION != $c_rel_type)) {
  									PRINT lang_get( 'any' );
  								} else {
! 									PRINT relationship_get_description_for_history ($c_rel_type); 
! 									if ($c_rel_type != BUG_NO_RELATION) {
! 										PRINT ' ' . $c_rel_bug;
! 									}
  								}
  
  							?>
--- 1733,1749 ----
  							}
  							?>
  			</td>
+ 
  			<td class="small-caption" valign="top" colspan="2" id="relationship_type_filter_target">
  							<input type="hidden" name="relationship_type" value="<?php echo $t_filter['relationship_type'];?>" />
  							<input type="hidden" name="relationship_bug" value="<?php echo $t_filter['relationship_bug'];?>" />
  							<?php
  								$c_rel_type = $t_filter['relationship_type'];
  								$c_rel_bug = $t_filter['relationship_bug'];
! 								if ( -1 == $c_rel_type || 0 == $c_rel_bug ) {
  									PRINT lang_get( 'any' );
  								} else {
! 								    PRINT relationship_get_description_for_history ($c_rel_type) . ' ' . $c_rel_bug;
  								}
  
  							?>
