View Issue Details

IDProjectCategoryView StatusLast Update
0004184mantisbtrelationshipspublic2004-11-06 06:24
Reportergrangeway Assigned Tomasc  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Fixed in Version0.19.1 
Summary0004184: Related issues resolved email should be more informative
Description

A RELATED issue has been RESOLVED.
^ this email should be more informative
i.e. should contain a number / link to the 'related' issue that was resolved.

TagsNo tags attached.
Attached Files
4184.txt (15,414 bytes)   
cvs diff -u (in directory C:\Inetpub\wwwroot\mantisbt\)
cvs diff: Diffing .
Index: bug_relationship_add.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/bug_relationship_add.php,v
retrieving revision 1.2
diff -u -r1.2 bug_relationship_add.php
--- bug_relationship_add.php	18 Jul 2004 00:07:44 -0000	1.2
+++ bug_relationship_add.php	5 Sep 2004 15:54:24 -0000
@@ -68,6 +68,10 @@
 			history_log_event_special( $f_src_bug_id, BUG_ADD_RELATIONSHIP, BUG_BLOCKS, $f_dest_bug_id );
 			history_log_event_special( $f_dest_bug_id, BUG_ADD_RELATIONSHIP, BUG_DEPENDANT, $f_src_bug_id );

+			# send email notification to the users addressed by both the bugs
+			email_relationship_added( $f_src_bug_id, $f_dest_bug_id, BUG_BLOCKS );
+			email_relationship_added( $f_dest_bug_id, $f_src_bug_id, BUG_DEPENDANT );
+
 			break;

 		case BUG_DEPENDANT:
@@ -78,6 +82,10 @@
 			history_log_event_special( $f_src_bug_id, BUG_ADD_RELATIONSHIP, BUG_DEPENDANT, $f_dest_bug_id );
 			history_log_event_special( $f_dest_bug_id, BUG_ADD_RELATIONSHIP, BUG_BLOCKS, $f_src_bug_id );

+			# send email notification to the users addressed by both the bugs
+			email_relationship_added( $f_src_bug_id, $f_dest_bug_id, BUG_DEPENDANT );
+			email_relationship_added( $f_dest_bug_id, $f_src_bug_id, BUG_BLOCKS );
+
 			break;

 		case BUG_HAS_DUPLICATE:
@@ -90,6 +98,10 @@
 			history_log_event_special( $f_src_bug_id, BUG_ADD_RELATIONSHIP, BUG_HAS_DUPLICATE, $f_dest_bug_id );
 			history_log_event_special( $f_dest_bug_id, BUG_ADD_RELATIONSHIP, BUG_DUPLICATE, $f_src_bug_id );

+			# send email notification to the users addressed by both the bugs
+			email_relationship_added( $f_src_bug_id, $f_dest_bug_id, BUG_HAS_DUPLICATE );
+			email_relationship_added( $f_dest_bug_id, $f_src_bug_id, BUG_DUPLICATE );
+
 			break;

 		case BUG_DUPLICATE:
@@ -100,6 +112,10 @@
 			history_log_event_special( $f_src_bug_id, BUG_ADD_RELATIONSHIP, BUG_DUPLICATE, $f_dest_bug_id );
 			history_log_event_special( $f_dest_bug_id, BUG_ADD_RELATIONSHIP, BUG_HAS_DUPLICATE, $f_src_bug_id );

+			# send email notification to the users addressed by both the bugs
+			email_relationship_added( $f_src_bug_id, $f_dest_bug_id, BUG_DUPLICATE );
+			email_relationship_added( $f_dest_bug_id, $f_src_bug_id, BUG_HAS_DUPLICATE );
+
 			break;

 		case BUG_RELATED:
@@ -109,6 +125,10 @@
 			history_log_event_special( $f_src_bug_id, BUG_ADD_RELATIONSHIP, BUG_RELATED, $f_dest_bug_id );
 			history_log_event_special( $f_dest_bug_id, BUG_ADD_RELATIONSHIP, BUG_RELATED, $f_src_bug_id );

+			# send email notification to the users addressed by both the bugs
+			email_relationship_added( $f_src_bug_id, $f_dest_bug_id, BUG_RELATED );
+			email_relationship_added( $f_dest_bug_id, $f_src_bug_id, BUG_RELATED );
+
 			break;

 		default:
@@ -120,10 +140,6 @@
 	# update bug last updated (just for the src bug)
 	bug_update_date( $f_src_bug_id );

-	# send email notification to the users addressed by both the bugs
-	email_relationship_added( $f_src_bug_id );
-	email_relationship_added( $f_dest_bug_id );
-
 	print_header_redirect_view( $f_src_bug_id );

 	# MASC RELATIONSHIP
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, $t_dest_bug_id, BUG_BLOCKS );

-	# 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, $f_bug_id, BUG_DEPENDANT );
+			}
+			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, $t_dest_bug_id, BUG_DEPENDANT );
+
+			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, $f_bug_id, BUG_BLOCKS );
+			}
+			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, $t_dest_bug_id, BUG_HAS_DUPLICATE );
+
+			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, $f_bug_id, BUG_DUPLICATE );
+			}
+			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, $t_dest_bug_id, BUG_DUPLICATE );
+
+			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, $f_bug_id, BUG_HAS_DUPLICATE );
+			}
+			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, $t_dest_bug_id, BUG_RELATED );
+
+			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, $f_bug_id, BUG_RELATED );
+			}
+			break;
+
+		default:
+			trigger_error( ERROR_GENERIC, ERROR );
+			break;
 	}

 	print_header_redirect_view( $f_bug_id );
Index: bug_report.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/bug_report.php,v
retrieving revision 1.38
diff -u -r1.38 bug_report.php
--- bug_report.php	21 Aug 2004 13:27:25 -0000	1.38
+++ bug_report.php	5 Sep 2004 15:54:26 -0000
@@ -136,7 +136,7 @@
 		history_log_event_special( $t_bug_id, BUG_ADD_RELATIONSHIP, BUG_BLOCKS, $f_master_bug_id );

 		# send email notification to the users addressed by the master bug
-		email_relationship_added( $f_master_bug_id );
+		email_relationship_added( $f_master_bug_id, $t_bug_id );
 	}

 	email_new_bug( $t_bug_id );
cvs diff: Diffing admin
cvs diff: Diffing admin/css
cvs diff: Diffing admin/upgrades
cvs diff: Diffing core
Index: core/email_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/email_api.php,v
retrieving revision 1.99
diff -u -r1.99 email_api.php
--- core/email_api.php	31 Aug 2004 03:54:47 -0000	1.99
+++ core/email_api.php	5 Sep 2004 15:54:32 -0000
@@ -389,7 +389,7 @@
 	# $p_notify_type: use check who she get notified of such event.
 	# $p_message_id: message id to be translated and included at the top of the email message.
 	# Return false if it were problems sending email
-	function email_generic( $p_bug_id, $p_notify_type, $p_message_id = null ) {
+	function email_generic( $p_bug_id, $p_notify_type, $p_message_id = null, $p_header_optional_params = null ) {
 		$t_ok = true;
 		if ( ON === config_get( 'enable_email_notification' ) ) {
 			ignore_user_abort( true );
@@ -405,7 +405,7 @@
 				# send email to every recipient
 				foreach ( $t_recipients as $t_user_id => $t_user_email ) {
 					$t_visible_bug_data = email_build_visible_bug_data( $t_user_id, $p_bug_id, $p_message_id );
-					$t_ok = email_bug_info_to_one_user( $t_visible_bug_data, $p_message_id, $t_project_id, $t_user_id ) && $t_ok;
+					$t_ok = email_bug_info_to_one_user( $t_visible_bug_data, $p_message_id, $t_project_id, $t_user_id, $p_header_optional_params ) && $t_ok;
 				}
 			}
 		}
@@ -416,15 +416,21 @@
 	# --------------------
 	# send notices when a relationship is ADDED
 	# MASC RELATIONSHIP
-	function email_relationship_added( $p_bug_id ) {
-		email_generic( $p_bug_id, 'relation', 'email_notification_title_for_action_relationship_added' );
+	function email_relationship_added( $p_bug_id, $p_related_bug_id, $p_rel_type ) {
+		$t_opt = array();
+		$t_opt[] = relationship_get_description_for_history( $p_rel_type );
+		$t_opt[] = bug_format_id( $p_related_bug_id );
+		email_generic( $p_bug_id, 'relation', 'email_notification_title_for_action_relationship_added', $t_opt );
 	}

 	# --------------------
 	# send notices when a relationship is DELETED
 	# MASC RELATIONSHIP
-	function email_relationship_deleted( $p_bug_id ) {
-		email_generic( $p_bug_id, 'relation', 'email_notification_title_for_action_relationship_deleted' );
+	function email_relationship_deleted( $p_bug_id, $p_related_bug_id, $p_rel_type ) {
+		$t_opt = array();
+		$t_opt[] = relationship_get_description_for_history( $p_rel_type );
+		$t_opt[] = bug_format_id( $p_related_bug_id );
+		email_generic( $p_bug_id, 'relation', 'email_notification_title_for_action_relationship_deleted', $t_opt );
 	}

 	# --------------------
@@ -460,7 +466,9 @@
 				$t_status = bug_get_field( $t_src_bug_id, 'status' );
 				if ( $t_status < config_get( 'bug_resolved_status_threshold' ) ) {
 					# sent the notification just for parent bugs not resolved/closed
-					email_generic( $t_src_bug_id, 'handler', $p_message_id );
+					$t_opt = array();
+					$t_opt[] = bug_format_id( $t_src_bug_id );
+					email_generic( $t_src_bug_id, 'handler', $p_message_id, $t_opt );
 				}
 			}
 		}
@@ -778,6 +786,9 @@
 		# build message

 		$t_message = lang_get_defaulted( $p_message_id, null );
+		if ( is_array( $p_header_optional_params ) ) {
+			$t_message = vsprintf( $t_message, $p_header_optional_params );
+		}
 		if ( ( $t_message !== null ) && ( !is_blank( $t_message ) ) ) {
 			$t_message .= "\n";
 		}
cvs diff: Diffing core/adodb
cvs diff: Diffing core/adodb/cute_icons_for_site
cvs diff: Diffing core/adodb/datadict
cvs diff: Diffing core/adodb/drivers
cvs diff: Diffing core/adodb/lang
cvs diff: Diffing core/adodb/tests
cvs diff: Diffing core/phpmailer
cvs diff: Diffing core/phpmailer/language
cvs diff: Diffing css
cvs diff: Diffing doc
cvs diff: Diffing graphs
cvs diff: Diffing images
cvs diff: Diffing javascript
cvs diff: Diffing lang
Index: lang/strings_english.txt
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/lang/strings_english.txt,v
retrieving revision 1.205
diff -u -r1.205 strings_english.txt
--- lang/strings_english.txt	1 Sep 2004 18:12:39 -0000	1.205
+++ lang/strings_english.txt	5 Sep 2004 15:54:39 -0000
@@ -292,10 +292,10 @@
 $s_email_notification_title_for_action_sponsorship_deleted = 'A sponsorship of the following issue was withdrawn.';

 $s_email_notification_title_for_action_bugnote_submitted = 'A NOTE has been added to this issue.';
-$s_email_notification_title_for_action_relationship_added = "A new RELATIONSHIP has been added to the following issue.";
-$s_email_notification_title_for_action_relationship_deleted = "A RELATIONSHIP has been deleted from the following issue.";
-$s_email_notification_title_for_action_relationship_child_resolved = "A RELATED issue has been RESOLVED.";
-$s_email_notification_title_for_action_relationship_child_closed = "A RELATED issue has been CLOSED.";
+$s_email_notification_title_for_action_relationship_added = "The RELATIONSHIP '%s issue %s' has been added to the following issue.";
+$s_email_notification_title_for_action_relationship_deleted = "The RELATIONSHIP '%s issue %s' has been deleted from the following issue.";
+$s_email_notification_title_for_action_relationship_child_resolved = "The RELATED issue %s has been RESOLVED.";
+$s_email_notification_title_for_action_relationship_child_closed = "The RELATED issue %s has been CLOSED.";

 $s_email_reporter = 'Reported By';
 $s_email_handler = 'Assigned To';
Index: lang/strings_italian.txt
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/lang/strings_italian.txt,v
retrieving revision 1.78
diff -u -r1.78 strings_italian.txt
--- lang/strings_italian.txt	26 Aug 2004 17:40:57 -0000	1.78
+++ lang/strings_italian.txt	5 Sep 2004 15:54:47 -0000
@@ -292,10 +292,10 @@
 $s_email_notification_title_for_action_sponsorship_deleted = "Una sponsorizzazione della seguente anomalia � stata eliminata.";

 $s_email_notification_title_for_action_bugnote_submitted = "Una NOTA � stata aggiunta a questa anomalia.";
-$s_email_notification_title_for_action_relationship_added = "E' stata aggiunta una RELAZIONE alla seguente anomalia.";
-$s_email_notification_title_for_action_relationship_deleted = "E' stata eliminata una RELAZIONE dalla seguente anomalia.";
-$s_email_notification_title_for_action_relationship_child_resolved = "E' stata RISOLTA una anomalia in RELAZIONE con l'anomalia seguente.";
-$s_email_notification_title_for_action_relationship_child_closed = "E' stata CHIUSA una anomalia in RELAZIONE con l'anomalia seguente.";
+$s_email_notification_title_for_action_relationship_added = "E' stata aggiunta la RELAZIONE '%s anomalia %s' alla seguente anomalia.";
+$s_email_notification_title_for_action_relationship_deleted = "E' stata eliminata la RELAZIONE '%s anomalia %s' dalla seguente anomalia.";
+$s_email_notification_title_for_action_relationship_child_resolved = "E' stata RISOLTA l'anomalia %s in RELAZIONE con la seguente anomalia.";
+$s_email_notification_title_for_action_relationship_child_closed = "E' stata CHIUSA l'anomalia %s in RELAZIONE con la seguente anomalia.";

 $s_email_reporter = "Segnalato da";
 $s_email_handler = "In carico a";
cvs diff: Diffing packages
cvs diff: Diffing sql
4184.txt (15,414 bytes)   

Relationships

child of 0004297 closedvboctor Mantis 0.19.1 release 

Activities

masc

masc

2004-08-05 05:11

reporter   ~0006651

Paul,
I completely agree with you on this point.
The main problem is that there is no possibility to add 'runtime' information in the first line of the email without changing a lot the email APIs.
We pass just the title string on the email to be fetched by the config file. There no possibility to add the bug number.
In any case I will try to find a workaround to reduce to the minimum the impact.

grangeway

grangeway

2004-08-27 19:44

reporter   ~0007262

Reminder sent to masc

did you take a look at this one?

masc

masc

2004-09-02 01:28

reporter   ~0007391

To be honest I forgot to analise deeply the problem. I'm going to find a workaround (may be changing some APIs in the email_api.php) to bypass the limit to have fixed title for the email notification. I will keep you informed.

Marcello

masc

masc

2004-09-05 10:51

reporter   ~0007442

Find attached the patch to fix this bug. Just few changes in email_api to send a more informative email notification. We need to change the related strings in the lang files. Now there in "printf" format in order to fill the string with the specific information of the bug.

This patch resolves also the bug 4431.

I guess you can update this Mantis installation asap in order to check the feedback on this new functionality.

vboctor

vboctor

2004-09-05 17:09

manager   ~0007447

I would rather if we apply the fix for 0004431 now, and apply the fix for this issue in the next release. I assume the fix for 0004331 shouldn't require a lot of changes, right?

masc

masc

2004-09-06 01:32

reporter   ~0007449

The fix for 0004431 is already attached to the bug so you can apply it right now.
I think it will be very useful to have also this fix as soon as possible to help to understand the relationship notification.

grangeway

grangeway

2004-10-05 16:10

reporter   ~0007918

Patch from Masc For this issue and other issues committed:
Fix 0004506: When cloning a bug you should be able to set the relationship
Fix 0004484: Show which project a related issue belongs to
Fix 0004184: Related issues resolved email should be more informative
Fix 0004224: Can't resolve issue as duplicate of other with existing "related to" relationship

Related Changesets

MantisBT: master 3df7d2c5

2004-10-05 17:12

Paul Richards


Details Diff
Commit of Masc's Patches:
Fix 0004506: When cloning a bug you should be able to set the relationship
Fix 0004484: Show which project a related issue belongs to
Fix 0004184: Related issues resolved email should be more informative
Fix 0004224: Can't resolve issue as duplicate of other with existing "related to" relationship

git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/trunk@3037 <a class="text" href="/?p=mantisbt.git;a=object;h=f5dc347c">f5dc347c</a>-c33d-0410-90a0-b07cc1902cb9
Affected Issues
0004184, 0004224, 0004484, 0004506
mod - core/relationship_api.php Diff File
mod - core/email_api.php Diff File
mod - bug_relationship_delete.php Diff File
mod - lang/strings_italian.txt Diff File
mod - bug_report_page.php Diff File
mod - core/bug_api.php Diff File
mod - bug_relationship_add.php Diff File
mod - core/constant_inc.php Diff File
mod - bug_report.php Diff File
mod - bug_report_advanced_page.php Diff File
mod - core/history_api.php Diff File
mod - lang/strings_english.txt Diff File