View Issue Details

IDProjectCategoryView StatusLast Update
0004431mantisbtrelationshipspublic2004-09-12 08:24
Reporterjferraz Assigned Tomasc  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version0.19.0rc1 
Fixed in Version0.19.0 
Summary0004431: Relationship removal is always "duplicate of" in history
Description

When you set a relationship between two bugs, and afterwards remove them, the removal is registered as "duplicate of" in history.

Steps To Reproduce

It was already reproduced... just open 0003987 and read the history carefully... If you want to reproduce:

  1. Report two bugs;
  2. Create a parent-child relationship between them;
  3. Delete the relationship;
  4. The history will contain something like:

08-29-04 19:26  ju  Relationship added    parent of 0000004
08-29-04 19:27 ju Relationship deleted duplicate of 0000004

TagsNo tags attached.
Attached Files
patch_4431.txt (2,772 bytes)   
cvs -z9 diff -u strings_english.txt (in directory D:\cvsroot\mantisbt\lang\)
Index: strings_english.txt
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/lang/strings_english.txt,v
retrieving revision 1.204
diff -u -r1.204 strings_english.txt
--- strings_english.txt	21 Aug 2004 13:52:18 -0000	1.204
+++ strings_english.txt	31 Aug 2004 20:09:49 -0000
@@ -76,6 +76,7 @@
 $s_related_to = "related to";
 $s_dependant_on = "parent of";
 $s_blocks = "child of";
+$s_relation_to = 'relation to';
 
 $s_new_bug = 'New Issue';
 $s_bugnote_added = 'Note Added';


cvs -z9 diff -u constant_inc.php (in directory D:\cvsroot\mantisbt\core\)
Index: constant_inc.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/constant_inc.php,v
retrieving revision 1.29
diff -u -r1.29 constant_inc.php
--- constant_inc.php	27 Aug 2004 00:29:55 -0000	1.29
+++ constant_inc.php	31 Aug 2004 20:29:11 -0000
@@ -145,6 +145,7 @@
 	define( 'BUG_DEPENDANT',	2 );
 	define( 'BUG_BLOCKS', 3 );
 	define( 'BUG_HAS_DUPLICATE', 4 );
+	define( 'BUG_DEL_RELATIONSHIP', 9 );
 
 	# error messages
 	define( 'ERROR_GENERIC',						0 );


cvs -z9 diff -u history_api.php (in directory D:\cvsroot\mantisbt\core\)
Index: history_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/history_api.php,v
retrieving revision 1.28
diff -u -r1.28 history_api.php
--- history_api.php	17 Aug 2004 18:01:18 -0000	1.28
+++ history_api.php	31 Aug 2004 20:29:51 -0000
@@ -307,7 +307,7 @@
 					break;
 				case BUG_DEL_RELATIONSHIP:
 					$t_note = lang_get( 'relationship_deleted' );
-					$t_change = relationship_get_description_for_history( $p_old_value ) . ' ' . bug_format_id( $p_new_value );
+					$t_change = relationship_get_description_for_history( BUG_DEL_RELATIONSHIP ) . ' ' . bug_format_id( $p_new_value );
 					break;
 				case BUG_CLONED_TO:
 					$t_note = lang_get( 'bug_cloned_to' );



cvs -z9 diff -u relationship_api.php (in directory D:\cvsroot\mantisbt\core\)
Index: relationship_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/relationship_api.php,v
retrieving revision 1.20
diff -u -r1.20 relationship_api.php
--- relationship_api.php	17 Aug 2004 18:01:19 -0000	1.20
+++ relationship_api.php	31 Aug 2004 20:29:58 -0000
@@ -351,6 +351,9 @@
 			case BUG_RELATED:
 				return lang_get( 'related_to' ) ;
 				break;
+			case BUG_DEL_RELATIONSHIP:
+				return lang_get( 'relation_to' );
+				break;
 			default:
 				trigger_error( ERROR_RELATIONSHIP_NOT_FOUND, ERROR );
 		}




patch_4431.txt (2,772 bytes)   
patch_4431_by_masc.txt (3,815 bytes)   
Index: bug_relationship_delete.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/bug_relationship_delete.php,v
retrieving revision 1.2
diff -u -r1.2 bug_relationship_delete.php
--- bug_relationship_delete.php	1 Aug 2004 22:31:48 -0000	1.2
+++ bug_relationship_delete.php	5 Sep 2004 15:54:24 -0000
@@ -8,8 +8,7 @@
 	# --------------------------------------------------------
 	# $Id: bug_relationship_delete.php,v 1.2 2004/08/01 22:31:48 prichards Exp $
 	# --------------------------------------------------------
-?>
-<?php
+
 	# --------------------------------------------------------
 	# 2004 by Marcello Scata' (marcello@marcelloscata.com) - ITALY
 	# --------------------------------------------------------
@@ -56,22 +55,70 @@

 	helper_ensure_confirmed( lang_get( 'delete_relationship_sure_msg' ), lang_get( 'delete_relationship_button' ) );

+	$t_bug_relationship_data = relationship_get( $f_rel_id );
+	$t_rel_type = $t_bug_relationship_data->type;
+
 	# delete relationship from the DB
 	relationship_delete( $f_rel_id );

 	# update bug last updated (just for the src bug)
 	bug_update_date( $f_bug_id );

-	# Add log line to the history of both bugs
-	# Send email notification to the users addressed by both the bugs
-	history_log_event_special( $f_bug_id, BUG_DEL_RELATIONSHIP, '', $t_dest_bug_id );
-	email_relationship_deleted( $f_bug_id );
+	# Add log lines to both the histories
+	switch ( $t_rel_type ) {
+		case BUG_BLOCKS:
+			history_log_event_special( $f_bug_id, BUG_DEL_RELATIONSHIP, BUG_BLOCKS, $t_dest_bug_id );
+			email_relationship_deleted( $f_bug_id );

-	# Add log line to the history of both bugs
-	# Send email notification to the users addressed by both the bugs
 	if ( bug_exists( $t_dest_bug_id )) {
-		history_log_event_special( $t_dest_bug_id, BUG_DEL_RELATIONSHIP, '', $f_bug_id );
-		email_relationship_deleted( $t_dest_bug_id );
+				history_log_event_special( $t_dest_bug_id, BUG_DEL_RELATIONSHIP, BUG_DEPENDANT, $f_bug_id );
+				email_relationship_deleted( $t_dest_bug_id );
+			}
+			break;
+
+		case BUG_DEPENDANT:
+			history_log_event_special( $f_bug_id, BUG_DEL_RELATIONSHIP, BUG_DEPENDANT, $t_dest_bug_id );
+			email_relationship_deleted( $f_bug_id );
+
+			if ( bug_exists( $t_dest_bug_id )) {
+				history_log_event_special( $t_dest_bug_id, BUG_DEL_RELATIONSHIP, BUG_BLOCKS, $f_bug_id );
+				email_relationship_deleted( $t_dest_bug_id );
+			}
+			break;
+
+		case BUG_HAS_DUPLICATE:
+			history_log_event_special( $f_bug_id, BUG_DEL_RELATIONSHIP, BUG_HAS_DUPLICATE, $t_dest_bug_id );
+			email_relationship_deleted( $f_bug_id );
+
+			if ( bug_exists( $t_dest_bug_id )) {
+				history_log_event_special( $t_dest_bug_id, BUG_DEL_RELATIONSHIP, BUG_DUPLICATE, $f_bug_id );
+				email_relationship_deleted( $t_dest_bug_id );
+			}
+			break;
+
+		case BUG_DUPLICATE:
+			history_log_event_special( $f_bug_id, BUG_DEL_RELATIONSHIP, BUG_DUPLICATE, $t_dest_bug_id );
+			email_relationship_deleted( $f_bug_id );
+
+			if ( bug_exists( $t_dest_bug_id )) {
+				history_log_event_special( $t_dest_bug_id, BUG_DEL_RELATIONSHIP, BUG_HAS_DUPLICATE, $f_bug_id );
+				email_relationship_deleted( $t_dest_bug_id );
+			}
+			break;
+
+		case BUG_RELATED:
+			history_log_event_special( $f_bug_id, BUG_DEL_RELATIONSHIP, BUG_RELATED, $t_dest_bug_id );
+			email_relationship_deleted( $f_bug_id );
+
+			if ( bug_exists( $t_dest_bug_id )) {
+				history_log_event_special( $t_dest_bug_id, BUG_DEL_RELATIONSHIP, BUG_RELATED, $f_bug_id );
+				email_relationship_deleted( $t_dest_bug_id );
+			}
+			break;
+
+		default:
+			trigger_error( ERROR_GENERIC, ERROR );
+			break;
 	}

 	print_header_redirect_view( $f_bug_id );
patch_4431_by_masc.txt (3,815 bytes)   

Relationships

has duplicate 0004472 closedjlatour Wrong entry in Issue History when deleting a "related to" relationship 
child of 0003987 closedvboctor Mantis 0.19.0 Release 

Activities

jlatour

jlatour

2004-08-29 17:37

reporter   ~0007293

Yeah, noticed that :-) I'm not convinced that it's always duplicate of, but it is at least in some cases.

jlatour

jlatour

2004-08-29 17:40

reporter   ~0007294

OK, so most cases!

bpfennig

bpfennig

2004-08-31 15:32

reporter   ~0007340

I think this is a good solution (see attached diff).

Any comments?

masc

masc

2004-09-01 10:32

reporter   ~0007355

The problem is due to the "enhancement" of the history details. Now the history shows the type of the relationship. The type stored in the DB is empty when deleting a relationship.
Find attached the patch to be applied at bug_relationship_delete.php to completely fix the problem. Now the type is stored when deleting as well.

masc

masc

2004-09-01 10:37

reporter   ~0007356

Inviato memorandum a jlatour

Jeroen, I attached a patch to fix the bug.

Marcello

jlatour

jlatour

2004-09-01 17:31

reporter   ~0007371

Do I see it correctly that bpfenning's patch just replaces 'duplicate of' with 'related to' or something like that, and masc's patch will insert the correct form?

bpfennig

bpfennig

2004-09-08 12:52

reporter   ~0007498

Yes, you are right - masc's solution is much better.

thraxisp

thraxisp

2004-09-11 19:16

reporter   ~0007531

masc patch applied to CVS.