示例#1
0
    if (user_exists($t_existing_bug->reporter_id)) {
        bug_monitor($f_bug_id, $t_existing_bug->reporter_id);
    }
    if (user_exists($t_existing_bug->handler_id)) {
        bug_monitor($f_bug_id, $t_existing_bug->handler_id);
    }
    bug_monitor_copy($f_bug_id, $t_updated_bug->duplicate_id);
}
event_signal('EVENT_UPDATE_BUG', array($t_existing_bug, $t_updated_bug));
# Allow a custom function to respond to the modifications made to the bug. Note
# that custom functions are being deprecated in MantisBT. You should migrate to
# the new plugin system instead.
helper_call_custom_function('issue_update_notify', array($f_bug_id));
# Send a notification of changes via email.
if ($t_resolve_issue) {
    email_resolved($f_bug_id);
    email_relationship_child_resolved($f_bug_id);
} else {
    if ($t_close_issue) {
        email_close($f_bug_id);
        email_relationship_child_closed($f_bug_id);
    } else {
        if ($t_reopen_issue) {
            email_reopen($f_bug_id);
        } else {
            if ($t_existing_bug->handler_id === NO_USER && $t_updated_bug->handler_id !== NO_USER) {
                email_assign($f_bug_id);
            } else {
                if ($t_existing_bug->status !== $t_updated_bug->status) {
                    $t_new_status_label = MantisEnum::getLabel(config_get('status_enum_string'), $t_updated_bug->status);
                    $t_new_status_label = str_replace(' ', '_', $t_new_status_label);
示例#2
0
         $agilemantis_tasks->addFinishedNote($agilemantis_tasks->us_id, $agilemantis_tasks->id, $user_id);
     }
     $task_closed = true;
 }
 if ($agilemantis_tasks->id == 0) {
     $agilemantis_tasks->capacity -= $agilemantis_tasks->planned_capacity;
 }
 $agilemantis_tasks->editTask();
 if ($_POST['oldstatus'] != $agilemantis_tasks->status) {
     $agilemantis_tasks->daily_scrum = 1;
 }
 $agilemantis_tasks->setDailyScrum($agilemantis_tasks->id, $agilemantis_tasks->daily_scrum);
 $agilemantis_tasks->setConfirmationStatus($agilemantis_tasks->us_id);
 if ($agilemantis_tasks->hasTasksLeft($agilemantis_tasks->us_id) != "") {
     $agilemantis_tasks->closeUserStory($agilemantis_tasks->us_id, 80, $user_id);
     email_resolved($agilemantis_tasks->us_id);
     email_relationship_child_resolved($agilemantis_tasks->us_id);
 }
 if (empty($_POST['id'])) {
     $agilemantis_tasks->setConfirmationStatus($agilemantis_tasks->us_id);
 }
 # add warning flag if current developer has no capacity
 if ($noCapacity == true) {
     $addlink = '&warning=2';
 }
 # add warning flag if task is resolved
 if ($task_resolved == true) {
     $addlink = '&warning=3';
     email_bugnote_add($agilemantis_tasks->us_id);
 }
 # add warning flag if task is closed
/**
 * resolve the given bug
 * @param int p_bug_id
 * @param int p_resolution resolution code
 * @param int p_status optional custom status (defaults to bug_resolved_status_threshold)
 * @param string p_fixed_in_version optional version string in which issue is fixed
 * @param int p_duplicate_id optional id of duplicate issue (defaults to null)
 * @param int p_handler_id optional id of issue handler
 * @param string p_bugnote_text optional bug note to add
 * @param bool p_bugnote_private optional true if bug note should be private (defaults to false)
 * @param string p_time_tracking optional time spent (defaults to '0:00')
 * @return bool (always true)
 * @access public
 */
function bug_resolve($p_bug_id, $p_resolution, $p_status = null, $p_fixed_in_version = '', $p_duplicate_id = null, $p_handler_id = null, $p_bugnote_text = '', $p_bugnote_private = false, $p_time_tracking = '0:00')
{
    $c_resolution = (int) $p_resolution;
    if (null == $p_status) {
        $p_status = config_get('bug_resolved_status_threshold');
    }
    $p_bugnote_text = trim($p_bugnote_text);
    # Add bugnote if supplied
    # Moved bugnote_add before bug_set_field calls in case time_tracking_no_note is off.
    # Error condition stopped execution but status had already been changed
    bugnote_add($p_bug_id, $p_bugnote_text, $p_time_tracking, $p_bugnote_private, 0, '', NULL, FALSE);
    $t_duplicate = !is_blank($p_duplicate_id) && $p_duplicate_id != 0;
    if ($t_duplicate) {
        if ($p_bug_id == $p_duplicate_id) {
            trigger_error(ERROR_BUG_DUPLICATE_SELF, ERROR);
            # never returns
        }
        # the related bug exists...
        bug_ensure_exists($p_duplicate_id);
        # check if there is other relationship between the bugs...
        $t_id_relationship = relationship_same_type_exists($p_bug_id, $p_duplicate_id, BUG_DUPLICATE);
        if ($t_id_relationship > 0) {
            # Update the relationship
            relationship_update($t_id_relationship, $p_bug_id, $p_duplicate_id, BUG_DUPLICATE);
            # Add log line to the history (both bugs)
            history_log_event_special($p_bug_id, BUG_REPLACE_RELATIONSHIP, BUG_DUPLICATE, $p_duplicate_id);
            history_log_event_special($p_duplicate_id, BUG_REPLACE_RELATIONSHIP, BUG_HAS_DUPLICATE, $p_bug_id);
        } else {
            if ($t_id_relationship != -1) {
                # Add the new relationship
                relationship_add($p_bug_id, $p_duplicate_id, BUG_DUPLICATE);
                # Add log line to the history (both bugs)
                history_log_event_special($p_bug_id, BUG_ADD_RELATIONSHIP, BUG_DUPLICATE, $p_duplicate_id);
                history_log_event_special($p_duplicate_id, BUG_ADD_RELATIONSHIP, BUG_HAS_DUPLICATE, $p_bug_id);
            }
        }
        # else relationship is -1 - same type exists, do nothing
        # Copy list of users monitoring the duplicate bug to the original bug
        bug_monitor_copy($p_bug_id, $p_duplicate_id);
        bug_set_field($p_bug_id, 'duplicate_id', (int) $p_duplicate_id);
    }
    bug_set_field($p_bug_id, 'status', $p_status);
    bug_set_field($p_bug_id, 'fixed_in_version', $p_fixed_in_version);
    bug_set_field($p_bug_id, 'resolution', $c_resolution);
    # only set handler if specified explicitly or if bug was not assigned to a handler
    if (null == $p_handler_id) {
        if (bug_get_field($p_bug_id, 'handler_id') == 0) {
            $p_handler_id = auth_get_current_user_id();
            bug_set_field($p_bug_id, 'handler_id', $p_handler_id);
        }
    } else {
        bug_set_field($p_bug_id, 'handler_id', $p_handler_id);
    }
    email_resolved($p_bug_id);
    email_relationship_child_resolved($p_bug_id);
    if ($c_resolution >= config_get('bug_resolution_fixed_threshold') && $c_resolution < config_get('bug_resolution_not_fixed_threshold')) {
        twitter_issue_resolved($p_bug_id);
    }
    return true;
}
示例#4
0
function bug_resolve($p_bug_id, $p_resolution, $p_fixed_in_version = '', $p_bugnote_text = '', $p_duplicate_id = null, $p_handler_id = null, $p_bugnote_private = false, $p_time_tracking = '0:00')
{
    $p_bugnote_text = trim($p_bugnote_text);
    # Add bugnote if supplied
    # Moved bugnote_add before bug_set_field calls in case time_tracking_no_note is off.
    # Error condition stopped execution but status had already been changed
    bugnote_add($p_bug_id, $p_bugnote_text, $p_time_tracking, $p_bugnote_private, 0, '', NULL, FALSE);
    $t_duplicate = !is_blank($p_duplicate_id) && $p_duplicate_id != 0;
    if ($t_duplicate) {
        if ($p_bug_id == $p_duplicate_id) {
            trigger_error(ERROR_BUG_DUPLICATE_SELF, ERROR);
            # never returns
        }
        # the related bug exists...
        bug_ensure_exists($p_duplicate_id);
        if (ON == config_get('enable_relationship')) {
            # check if there is other relationship between the bugs...
            $t_id_relationship = relationship_same_type_exists($p_bug_id, $p_duplicate_id, BUG_DUPLICATE);
            if ($t_id_relationship == -1) {
                # the relationship type is already set. Nothing to do
            } else {
                if ($t_id_relationship > 0) {
                    # there is already a relationship between them -> we have to update it and not to add a new one
                    helper_ensure_confirmed(lang_get('replace_relationship_sure_msg'), lang_get('replace_relationship_button'));
                    # Update the relationship
                    relationship_update($t_id_relationship, $p_bug_id, $p_duplicate_id, BUG_DUPLICATE);
                    # Add log line to the history (both bugs)
                    history_log_event_special($p_bug_id, BUG_REPLACE_RELATIONSHIP, BUG_DUPLICATE, $p_duplicate_id);
                    history_log_event_special($p_duplicate_id, BUG_REPLACE_RELATIONSHIP, BUG_HAS_DUPLICATE, $p_bug_id);
                } else {
                    # Add the new relationship
                    relationship_add($p_bug_id, $p_duplicate_id, BUG_DUPLICATE);
                    # Add log line to the history (both bugs)
                    history_log_event_special($p_bug_id, BUG_ADD_RELATIONSHIP, BUG_DUPLICATE, $p_duplicate_id);
                    history_log_event_special($p_duplicate_id, BUG_ADD_RELATIONSHIP, BUG_HAS_DUPLICATE, $p_bug_id);
                }
            }
        }
        bug_set_field($p_bug_id, 'duplicate_id', (int) $p_duplicate_id);
    }
    $c_resolution = db_prepare_int($p_resolution);
    bug_set_field($p_bug_id, 'status', config_get('bug_resolved_status_threshold'));
    bug_set_field($p_bug_id, 'fixed_in_version', $p_fixed_in_version);
    bug_set_field($p_bug_id, 'resolution', $c_resolution);
    # only set handler if specified explicitly or if bug was not assigned to a handler
    if (null == $p_handler_id) {
        if (bug_get_field($p_bug_id, 'handler_id') == 0) {
            $p_handler_id = auth_get_current_user_id();
            bug_set_field($p_bug_id, 'handler_id', $p_handler_id);
        }
    } else {
        bug_set_field($p_bug_id, 'handler_id', $p_handler_id);
    }
    email_resolved($p_bug_id);
    if ($c_resolution == FIXED) {
        twitter_issue_resolved($p_bug_id);
    }
    # MASC RELATIONSHIP
    if (ON == config_get('enable_relationship')) {
        email_relationship_child_resolved($p_bug_id);
    }
    # MASC RELATIONSHIP
    return true;
}