View Issue Details

IDProjectCategoryView StatusLast Update
0003589mantisbtemailpublic2016-01-01 13:09
Reportermorganparry Assigned Tovboctor  
PrioritynormalSeverityfeatureReproducibilityalways
Status closedResolutionduplicate 
Summary0003589: Previous handlers not notified of change of assignment
Description

When a bug is reassigned to another user, the previous handler doesn't get an email to tell them about this.

Additional Information

I fixed this in our installation by modifying email_assign() in email_api.php to look like this:

function email_assign( $p_bug_id, $p_old_handler_id = -1 ) {
    $t_bcc = email_build_bcc_list( $p_bug_id, 'assigned' );
    if( $p_old_handler_id != -1 && user_exists($p_old_handler_id) && user_is_enabled($p_old_handler_id) )
    {
        $t_old_handler_email = user_get_email( $p_old_handler_id );
        if( !is_blank($t_old_handler_email) )
        {
            if( !empty($t_bcc) )
            {
                $t_bcc .= ", ";
            }
            $t_bcc .= $t_old_handler_email;
        }
    }
    email_bug_info( $p_bug_id, lang_get( 'email_assigned_msg' ), $t_bcc );
}

Then in the bug_update() function, in bug_api.php, I modified the ASSIGNED case, around line 583 in v0.18.1, to look like this:

        case ASSIGNED:
            if( $p_bug_data->handler_id != $t_old_data->handler_id )
            {
                email_assign( $p_bug_id, $t_old_data->handler_id );
            }
            else if( $p_bug_data->status != $t_old_data->status )
            {
                email_assign( $p_bug_id );
            }
            break;
Tagspatch
Attached Files
assign_diff.txt (3,297 bytes)   
==== core/bug_api.php#2 (text) ====

@@ -830,7 +830,7 @@
 
 			# bug assigned
 			if ( $t_old_data->handler_id != $p_bug_data->handler_id ) {
-				email_generic( $p_bug_id, 'owner', $t_action_prefix . 'assigned' );
+                email_assign( $p_bug_id, $t_old_data->handler_id );
 				return true;
 			}
 
@@ -1113,7 +1113,7 @@
 			bug_clear_cache( $p_bug_id );
 
 			# send assigned to email
-			email_assign( $p_bug_id );
+			email_assign( $p_bug_id, $h_handler_id );
 		}
 
 		return true;

==== core/email_api.php#2 (text) ====

@@ -169,7 +169,7 @@
 	# @@@ yarick123: email_collect_recipients(...) will be completely rewritten to provide additional
 	#     information such as language, user access,..
 	# @@@ yarick123:sort recipients list by language to reduce switches between different languages
-	function email_collect_recipients( $p_bug_id, $p_notify_type ) {
+	function email_collect_recipients( $p_bug_id, $p_notify_type, $p_additional_recipient_ids = null ) {
 		$c_bug_id = db_prepare_int( $p_bug_id );
 
 		$t_recipients = array();
@@ -241,6 +241,15 @@
 			}
 		}
 
+        # Any additional recipients provided.
+        if( !is_null($p_additional_recipient_ids) ) {
+            foreach( $p_additional_recipient_ids as $t_additional_id ) {
+                if( $t_additional_id ) {
+                    $t_recipients[$t_additional_id] = true;
+                }
+            }
+        }
+
 		# set up to eliminate unwanted users
 		#  get list of status values that are not covered specifically in the prefs
 		#  These are handled by email_on_status generically
@@ -427,7 +436,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, $p_header_optional_params = null ) {
+	function email_generic( $p_bug_id, $p_notify_type, $p_message_id = null, $p_header_optional_params = null, $p_additional_recipient_ids = null ) {
 		$t_ok = true;
 		if ( ON === config_get( 'enable_email_notification' ) ) {
 			ignore_user_abort( true );
@@ -435,7 +444,7 @@
 			# @@@ yarick123: email_collect_recipients(...) will be completely rewritten to provide additional
 			#     information such as language, user access,..
 			# @@@ yarick123:sort recipients list by language to reduce switches between different languages
-			$t_recipients = email_collect_recipients( $p_bug_id, $p_notify_type );
+			$t_recipients = email_collect_recipients( $p_bug_id, $p_notify_type, $p_additional_recipient_ids );
 
 			$t_project_id = bug_get_field( $p_bug_id, 'project_id' );
 			if ( is_array( $t_recipients ) ) {
@@ -599,8 +608,8 @@
 	}
 	# --------------------
 	# send notices when a bug is ASSIGNED
-	function email_assign( $p_bug_id ) {
-		email_generic( $p_bug_id, 'owner', 'email_notification_title_for_action_bug_assigned' );
+	function email_assign( $p_bug_id, $p_old_handler_id = 0 ) {
+		email_generic( $p_bug_id, 'owner', 'email_notification_title_for_action_bug_assigned', null, array($p_old_handler_id) );
 	}
 	# --------------------
 	# send notices when a bug is DELETED

assign_diff.txt (3,297 bytes)   

Relationships

duplicate of 0020321 closedvboctor Re-assigned issues don't trigger 'owner' notifications 
has duplicate 0007379 closedatrol Notification-Mail when Editor is changed to other person 

Activities

morganparry

morganparry

2004-03-03 10:24

reporter   ~0005158

Updated patches for v0.18.2:

  • In email_api.php, change email_assign() to look like:

    function email_assign( $p_bug_id, $p_old_handler_id = 0 ) {
    email_generic( $p_bug_id, 'assigned', 'email_notification_title_for_action_bug_assigned', $p_old_handler_id );
    }

  • In the same file, change email_generic() to look like:

    function email_generic( $p_bug_id, $p_notify_type, $p_message_id = null, $p_additional_recipient_id = 0 ) {
    $t_bcc = email_build_bcc_list( $p_bug_id, $p_notify_type );
    if( $p_additional_recipient_id && user_exists($p_additional_recipient_id) && user_is_enabled($p_additional_recipient_id) )
    {
    $t_additional_recipient_email = user_get_email( $p_additional_recipient_id );
    if( !is_blank($t_additional_recipient_email) )
    {
    $t_bcc = $t_additional_recipient_email . ', ' . $t_bcc;
    }
    }
    email_bug_info( $p_bug_id, $p_message_id, $t_bcc );
    }

  • Finally, in bug_api.php, change line 562 from

    email_generic( $p_bug_id, 'assigned', $t_action_prefix . 'assigned' );

to

email_generic( $p_bug_id, 'assigned', $t_action_prefix . 'assigned', $t_old_data->handler_id );
morganparry

morganparry

2006-08-14 10:45

reporter   ~0013268

I've attached a unified diff against 1.0.5 to fix this.