/
bug_update.php
92 lines (78 loc) · 4.01 KB
/
bug_update.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
# Mantis - a php based bugtracking system
# Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
# Copyright (C) 2002 - 2003 Mantis Team - mantisbt-dev@lists.sourceforge.net
# This program is distributed under the terms and conditions of the GPL
# See the README and LICENSE files for details
# --------------------------------------------------------
# $Id: bug_update.php,v 1.48 2003-01-23 23:02:57 jlatour Exp $
# --------------------------------------------------------
?>
<?php
# Update bug data then redirect to the appropriate viewing page
?>
<?php
require_once( 'core.php' );
require_once( $g_core_path . 'bug_api.php' );
require_once( $g_core_path . 'project_api.php' );
require_once( $g_core_path . 'bugnote_api.php' );
require_once( $g_core_path . 'custom_field_api.php' );
?>
<?php login_cookie_check() ?>
<?php
$f_bug_id = gpc_get_int( 'bug_id' );
project_access_check( $f_bug_id );
check_access( config_get( 'update_bug_threshold' ) );
bug_ensure_exists( $f_bug_id );
# if bug is private, make sure user can view private bugs
# use the db view state rather than the new one to check
access_bug_check( $f_bug_id );
# extract current extended information
$t_bug_data = bug_get( $f_bug_id, true );
$t_bug_data->reporter_id = gpc_get_int( 'reporter_id', $t_bug_data->reporter_id );
$t_bug_data->handler_id = gpc_get_int( 'handler_id', $t_bug_data->handler_id );
$t_bug_data->duplicate_id = gpc_get_int( 'duplicate_id', $t_bug_data->duplicate_id );
$t_bug_data->priority = gpc_get_int( 'priority', $t_bug_data->priority );
$t_bug_data->severity = gpc_get_int( 'severity', $t_bug_data->severity );
$t_bug_data->reproducibility = gpc_get_int( 'reproducibility', $t_bug_data->reproducibility );
$t_bug_data->status = gpc_get_int( 'status', $t_bug_data->status );
$t_bug_data->resolution = gpc_get_int( 'resolution', $t_bug_data->resolution );
$t_bug_data->projection = gpc_get_int( 'projection', $t_bug_data->projection );
$t_bug_data->category = gpc_get_string( 'category', $t_bug_data->category );
$t_bug_data->eta = gpc_get_int( 'eta', $t_bug_data->eta );
$t_bug_data->os = gpc_get_string( 'os', $t_bug_data->os );
$t_bug_data->os_build = gpc_get_string( 'os_build', $t_bug_data->os_build );
$t_bug_data->platform = gpc_get_string( 'platform', $t_bug_data->platform );
$t_bug_data->version = gpc_get_string( 'version', $t_bug_data->version );
$t_bug_data->build = gpc_get_string( 'build', $t_bug_data->build );
$t_bug_data->view_state = gpc_get_int( 'view_state', $t_bug_data->view_state );
$t_bug_data->summary = gpc_get_string( 'summary', $t_bug_data->summary );
$t_bug_data->description = gpc_get_string( 'description', $t_bug_data->description );
$t_bug_data->steps_to_reproduce = gpc_get_string( 'steps_to_reproduce', $t_bug_data->steps_to_reproduce );
$t_bug_data->additional_information = gpc_get_string( 'additional_information', $t_bug_data->additional_information );
$f_private = gpc_get_bool( 'private' );
$f_bugnote_text = gpc_get_string( 'bugnote_text', '' );
# Handle auto-assigning
if ( ( NEW_ == $t_bug_data->status )
&& ( 0 != $t_bug_data->handler_id )
&& ( ON == config_get( 'auto_set_status_to_assigned' ) ) ) {
$t_bug_data->status = ASSIGNED;
}
# Update the bug entry
bug_update( $f_bug_id, $t_bug_data, true );
if( ON == config_get( 'use_experimental_custom_fields' ) ) {
$t_related_custom_field_ids = custom_field_get_linked_ids( helper_get_current_project() );
foreach( $t_related_custom_field_ids as $t_id ) {
$t_def = custom_field_get_definition( $t_id );
if ( !custom_field_set_value( $t_id, $f_bug_id, gpc_get_string( "custom_field_$t_id", $t_def['default_value'] ) ) ) {
trigger_error( ERROR_CUSTOM_FIELD_INVALID_VALUE, ERROR );
}
}
} # ON = config_get( 'use_experimental_custom_fields' )
# Add a bugnote if there is one
$f_bugnote_text = trim( $f_bugnote_text );
if ( !is_blank( $f_bugnote_text ) ) {
bugnote_add( $f_bug_id, $f_bugnote_text, $f_private );
}
print_header_redirect_view( $f_bug_id );
?>