예제 #1
0
파일: mantishelper.php 프로젝트: n2i/xvnkb
function updateMantisBugStatusById($bug_id, $status)
{
    $bug = bug_get($bug_id);
    $bug->status = $status;
    $result = bug_update($bug_id, $bug);
    return $result;
}
예제 #2
0
            # bug_close updates the status and bugnote and sends message
            bug_close($f_bug_id, $f_bugnote_text, $f_private, $f_time_tracking);
            $t_notify = false;
            $t_bug_note_set = true;
            break;
        case config_get('bug_reopen_status'):
            if ($t_old_bug_status >= $t_resolved) {
                bug_set_field($f_bug_id, 'handler_id', $t_bug_data->handler_id);
                # fix: update handler_id before calling bug_reopen
                # bug_reopen updates the status and bugnote and sends message
                bug_reopen($f_bug_id, $f_bugnote_text, $f_time_tracking, $f_private);
                $t_notify = false;
                $t_bug_note_set = true;
                // update bug data with fields that may be updated inside bug_resolve(), otherwise changes will be overwritten
                // in bug_update() call below.
                $t_bug_data->status = bug_get_field($f_bug_id, 'status');
                $t_bug_data->resolution = bug_get_field($f_bug_id, 'resolution');
                break;
            }
            # else fall through to default
    }
}
# Add a bugnote if there is one
if (!$t_bug_note_set) {
    bugnote_add($f_bug_id, $f_bugnote_text, $f_time_tracking, $f_private, 0, '', NULL, FALSE);
}
# Update the bug entry, notify if we haven't done so already
bug_update($f_bug_id, $t_bug_data, true, false == $t_notify);
form_security_purge('bug_update');
helper_call_custom_function('issue_update_notify', array($f_bug_id));
print_successful_redirect_to_bug($f_bug_id);
예제 #3
0
 public function put($request)
 {
     /*
      *      Replaces the bug resource using the representation provided.
      *
      *      @param $request - The HTTP request we're responding to
      */
     $this->bug_id = Bug::get_mantis_id_from_url($request->url);
     $this->populate_from_repr($request->body);
     # Access checks are from Mantis's bug_update.php
     if (!(access_has_bug_level(access_get_status_threshold($f_new_status, bug_get_field($this->bug_id, 'project_id')), $this->bug_id) || access_has_bug_level(config_get('update_bug_threshold'), $this->bug_id) || bug_get_field($this->bug_id, 'reporter_id') == auth_get_current_user_id() && (ON == config_get('allow_reporter_reopen') || ON == config_get('allow_reporter_close')))) {
         throw new HTTPException(403, "Access denied to update bug");
     }
     bug_update($this->bug_id, $this->to_bugdata(), TRUE);
     $resp = new Response();
     $resp->status = 204;
     return $resp;
 }
예제 #4
0
/**
 * Update Issue in database
 *
 * Created By KGB
 * @param string $p_username The name of the user trying to add the issue.
 * @param string $p_password The password of the user.
 * @param Array $p_issue A IssueData structure containing information about the new issue.
 * @return integer The id of the created issue.
 */
function mc_issue_update($p_username, $p_password, $p_issue_id, $p_issue)
{
    $t_user_id = mci_check_login($p_username, $p_password);
    if ($t_user_id === false) {
        return new soap_fault('Client', '', 'Access Denied');
    }
    if (!bug_exists($p_issue_id)) {
        return new soap_fault('Server', '', "Issue '{$p_issue_id}' does not exist.");
    }
    $t_project_id = bug_get_field($p_issue_id, 'project_id');
    if (!mci_has_readwrite_access($t_user_id, $t_project_id)) {
        return new soap_fault('Client', '', 'Access Denied');
    }
    extract($p_issue, EXTR_PREFIX_ALL, 'v');
    $t_project_id = mci_get_project_id($v_project);
    $t_handler_id = mci_get_user_id($v_handler);
    $t_priority_id = mci_get_priority_id($v_priority);
    $t_severity_id = mci_get_severity_id($v_severity);
    $t_status_id = mci_get_status_id($v_status);
    $t_reproducibility_id = mci_get_reproducibility_id($v_reproducibility);
    $t_resolution_id = mci_get_resolution_id($v_resolution);
    $t_projection_id = mci_get_projection_id($v_projection);
    $t_eta_id = mci_get_eta_id($v_eta);
    $t_view_state_id = mci_get_view_state_id($v_view_state);
    $t_reporter_id = mci_get_user_id($v_reporter);
    if ($t_reporter_id == 0) {
        $t_reporter_id = $t_user_id;
    }
    if ($t_project_id == 0 || !project_exists($t_project_id)) {
        if ($t_project_id == 0) {
            return new soap_fault('Client', '', "Project '" . $v_project['name'] . "' does not exist.");
        } else {
            return new soap_fault('Client', '', "Project '{$t_project_id}' does not exist.");
        }
    }
    if (!access_has_bug_level(config_get('update_bug_threshold'), $p_issue_id, $t_user_id)) {
        return new soap_fault('Client', '', "User '{$t_user_id}' does not have access right to report issues.");
    }
    if ($t_handler_id != 0 && !user_exists($t_handler_id)) {
        return new soap_fault('Client', '', "User '{$t_handler_id}' does not exist.");
    }
    if (!in_array($v_category, mci_category_get_all_rows($t_project_id, $t_user_id))) {
        $t_error_when_category_not_found = config_get('mc_error_when_category_not_found');
        if ($t_error_when_category_not_found == ON) {
            if (is_blank($v_category) && count(category_get_all_rows($t_project_id)) == 0) {
                $v_category = '';
                // it is ok to have category as empty if project has no categories
            } else {
                return new soap_fault('Client', '', "Category '{$v_category}' does not exist in project '{$t_project_id}'.");
            }
        } else {
            $t_category_when_not_found = config_get('mc_category_when_not_found');
            $v_category = $t_category_when_not_found;
        }
    }
    if (isset($v_version) && !is_blank($v_version) && !version_get_id($v_version, $t_project_id)) {
        $t_error_when_version_not_found = config_get('mc_error_when_version_not_found');
        if ($t_error_when_version_not_found == ON) {
            $t_project_name = project_get_name($t_project_id);
            return new soap_fault('Client', '', "Version '{$v_version}' does not exist in project '{$t_project_name}'.");
        } else {
            $t_version_when_not_found = config_get('mc_version_when_not_found');
            $v_version = $t_version_when_not_found;
        }
    }
    if (is_blank($v_summary)) {
        return new soap_fault('Client', '', "Mandatory field 'summary' is missing.");
    }
    if (is_blank($v_description)) {
        return new soap_fault('Client', '', "Mandatory field 'description' is missing.");
    }
    if ($v_priority == 0) {
        $v_priority = config_get('default_bug_priority');
    }
    if ($v_severity == 0) {
        $v_severity = config_get('default_bug_severity');
    }
    if ($v_view_state == 0) {
        $v_view_state = config_get('default_bug_view_status');
    }
    if ($v_reproducibility == 0) {
        $v_reproducibility = 10;
    }
    $t_bug_data = new BugData();
    $t_bug_data->project_id = $t_project_id;
    $t_bug_data->reporter_id = $t_reporter_id;
    $t_bug_data->handler_id = $t_handler_id;
    $t_bug_data->priority = $t_priority_id;
    $t_bug_data->severity = $t_severity_id;
    $t_bug_data->reproducibility = $t_reproducibility_id;
    $t_bug_data->status = $t_status_id;
    $t_bug_data->resolution = $t_resolution_id;
    $t_bug_data->projection = $t_projection_id;
    $t_bug_data->category = $v_category;
    $t_bug_data->date_submitted = isset($v_date_submitted) ? $v_date_submitted : '';
    $t_bug_data->last_updated = isset($v_last_updated) ? $v_last_updated : '';
    $t_bug_data->eta = $t_eta_id;
    $t_bug_data->os = isset($v_os) ? $v_os : '';
    $t_bug_data->os_build = isset($v_os_build) ? $v_os_build : '';
    $t_bug_data->platform = isset($v_platform) ? $v_platform : '';
    $t_bug_data->version = isset($v_version) ? $v_version : '';
    $t_bug_data->fixed_in_version = isset($v_fixed_in_version) ? $v_fixed_in_version : '';
    $t_bug_data->build = isset($v_build) ? $v_build : '';
    $t_bug_data->view_state = $t_view_state_id;
    $t_bug_data->summary = $v_summary;
    $t_bug_data->sponsorship_total = isset($v_sponsorship_total) ? $v_sponsorship_total : 0;
    # omitted:
    # var $bug_text_id
    # $t_bug_data->profile_id;
    # extended info
    $t_bug_data->description = $v_description;
    $t_bug_data->steps_to_reproduce = isset($v_steps_to_reproduce) ? $v_steps_to_reproduce : '';
    $t_bug_data->additional_information = isset($v_additional_information) ? $v_additional_information : '';
    # submit the issue
    $t_is_success = bug_update($p_issue_id, $t_bug_data, true, false);
    mci_issue_set_custom_fields($p_issue_id, $v_custom_fields);
    if (isset($v_notes) && is_array($v_notes)) {
        foreach ($v_notes as $t_note) {
            if (isset($t_note['view_state'])) {
                $t_view_state = $t_note['view_state'];
            } else {
                $t_view_state = config_get('default_bugnote_view_status');
            }
            // TODO: consider supporting updating of bugnotes and detecting the ones that haven't changed.
            $t_view_state_id = mci_get_enum_id_from_objectref('view_state', $t_view_state);
            bugnote_add($p_issue_id, $t_note['text'], '0:00', $t_view_state_id == VS_PRIVATE, BUGNOTE, '', $t_user_id, FALSE);
        }
    }
    return $t_is_success;
}
# rth is a requirement, test, and bugtracking system
# Copyright (C) 2005 George Holbrook - rth@lists.sourceforge.net
# This program is distributed under the terms and conditions of the GPL
# See the README and LICENSE files for details
#----------------------------------------------------------------------
# ------------------------------------
# Bug Detail Update Action Page
#
# $RCSfile: bug_detail_update_action.php,v $  $Revision   $
# ------------------------------------
include "./api/include_api.php";
auth_authenticate_user();
$s_bug_details = session_get_properties("bug");
$bug_id = $s_bug_details['bug_id'];
$redirect_on_success = 'bug_detail_page.php';
$redirect_on_error = 'bug_detail_update_page.php';
$redirect_on_closed = 'bug_close_page.php';
session_validate_form_set($_POST, $redirect_on_error);
$value = session_validate_form_get_field('bug_status');
bug_update($bug_id, session_validate_form_get_field('bug_status'), session_validate_form_get_field('bug_category'), session_validate_form_get_field('discovery_period'), session_validate_form_get_field('bug_component'), session_validate_form_get_field('bug_priority'), session_validate_form_get_field('bug_severity'), session_validate_form_get_field('found_in_release'), session_validate_form_get_field('assign_to_release'), session_validate_form_get_field('implemented_in_release'), session_validate_form_get_field('assigned_to'), session_validate_form_get_field('assigned_to_developer'), session_validate_form_get_field('summary_required'), session_validate_form_get_field('bug_description_required', "", session_use_FCKeditor()));
if ($value == 'Closed') {
    html_redirect($redirect_on_closed . "?bug_id={$bug_id}");
}
session_validate_form_reset();
html_print_operation_successful('update_bug_page', $redirect_on_success);
# ------------------------------------
# $Log: bug_detail_update_action.php,v $
# Revision 1.1.1.1  2005/11/30 23:00:56  gth2
# importing initial version - gth
#
# ------------------------------------