View Issue Details

IDProjectCategoryView StatusLast Update
0004917mantisbtemailpublic2004-12-11 03:01
Reporterpacketeer Assigned Tovboctor  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version0.19.1 
Fixed in Version0.19.2 
Summary0004917: A bug concerning mail notification is found in function bug_update of ../core/bug_api.php.
Description

The problem is:

  1. Mail notification does NOT work as per configuration of $g_notify_flags for custom statuses.
  2. When hander (assigned to) of an issue is updated together with a status change, the mail heading sent to the new handler is "The following issue has been ASSIGNED", rather than being worded with the new status heading (e.g. "The following issue has been RESOLVED")

The bug is due to in function bug_update of ../core/bug_api.php, "bug assigned" check happening before "status changed" as listed below (the check should be the other way around):

            if ( false == $p_bypass_mail ) {                # allow bypass if user is sending mail separately
                    $t_action_prefix = 'email_notification_title_for_action_bug_';
                    $t_status_prefix = 'email_notification_title_for_status_bug_';

                    # bug assigned
                    if ( $t_old_data->handler_id != $p_bug_data->handler_id ) {
                            email_generic( $p_bug_id, 'owner', $t_action_prefix . 'assigned' );
                            return true;
                    }

                    # status changed
                    if ( $t_old_data->status != $p_bug_data->status ) {
                            $t_status = get_enum_to_string( config_get( 'status_enum_string' ), $p_bug_data->status );

                            $t_status = str_replace( ' ', '_', $t_status );
                            email_generic( $p_bug_id, $t_status, $t_status_prefix . $t_status );
                            return true;
                    }

The fix is simply to swap the order of the 2 if blocks around, so that "status changed" is checked BEFORE "bug assigned". The fixed code is as follows:

                    # status changed
                    if ( $t_old_data->status != $p_bug_data->status ) {
                            $t_status = get_enum_to_string( config_get( 'status_enum_string' ), $p_bug_data->status );

                            $t_status = str_replace( ' ', '_', $t_status );
                            email_generic( $p_bug_id, $t_status, $t_status_prefix . $t_status );
                            return true;
                    }

                    # bug assigned
                    if ( $t_old_data->handler_id != $p_bug_data->handler_id ) {
                            email_generic( $p_bug_id, 'owner', $t_action_prefix . 'assigned' );
                            return true;
                    } 
TagsNo tags attached.

Relationships

child of 0004818 closedvboctor Mantis 0.19.2 release 

Activities

vboctor

vboctor

2004-11-30 05:08

manager   ~0008450

Although this was by design, I thought about it again and think that the change of status is a more important change, specially after we added the change status feature where more stress is now on the change of status.

jlatour

jlatour

2004-12-01 03:22

reporter   ~0008464

So this should be reopened?

vboctor

vboctor

2004-12-01 05:33

manager   ~0008468

Nope, I actually fixed the implementation as requested. This is already in CVS.