Exemple #1
0
# 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);
                    email_generic($f_bug_id, $t_new_status_label, 'email_notification_title_for_status_bug_' . $t_new_status_label);
                } else {
                    email_generic($f_bug_id, 'updated', 'email_notification_title_for_action_bug_updated');
                }
            }
        }
    }
}
# Twitter notification of bug update.
if ($t_resolve_issue && $t_updated_bug->resolution >= config_get('bug_resolution_fixed_threshold') && $t_updated_bug->resolution < config_get('bug_resolution_not_fixed_threshold')) {
    twitter_issue_resolved($f_bug_id);
/**
 * assign the bug to the given user
 * @param array p_bug_id_array integer array representing bug ids to cache
 * @return null
 * @access public
 * @uses database_api.php
 */
function bug_assign($p_bug_id, $p_user_id, $p_bugnote_text = '', $p_bugnote_private = false)
{
    $c_bug_id = db_prepare_int($p_bug_id);
    $c_user_id = db_prepare_int($p_user_id);
    if ($c_user_id != NO_USER && !access_has_bug_level(config_get('handle_bug_threshold'), $p_bug_id, $p_user_id)) {
        trigger_error(ERROR_USER_DOES_NOT_HAVE_REQ_ACCESS);
    }
    # extract current information into history variables
    $h_status = bug_get_field($p_bug_id, 'status');
    $h_handler_id = bug_get_field($p_bug_id, 'handler_id');
    if (ON == config_get('auto_set_status_to_assigned') && NO_USER != $p_user_id) {
        $t_ass_val = config_get('bug_assigned_status');
    } else {
        $t_ass_val = $h_status;
    }
    $t_bug_table = db_get_table('mantis_bug_table');
    if ($t_ass_val != $h_status || $p_user_id != $h_handler_id) {
        # get user id
        $query = "UPDATE {$t_bug_table}\n\t\t\t\t\t  SET handler_id=" . db_param() . ", status=" . db_param() . "\n\t\t\t\t\t  WHERE id=" . db_param();
        db_query_bound($query, array($c_user_id, $t_ass_val, $c_bug_id));
        # log changes
        history_log_event_direct($c_bug_id, 'status', $h_status, $t_ass_val);
        history_log_event_direct($c_bug_id, 'handler_id', $h_handler_id, $p_user_id);
        # Add bugnote if supplied ignore false return
        bugnote_add($p_bug_id, $p_bugnote_text, 0, $p_bugnote_private, 0, '', NULL, FALSE);
        # updated the last_updated date
        bug_update_date($p_bug_id);
        bug_clear_cache($p_bug_id);
        # send assigned to email
        email_assign($p_bug_id);
    }
    return true;
}