Skip to content

Commit

Permalink
Added bug history functionality.
Browse files Browse the repository at this point in the history
git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/trunk@1063 f5dc347c-c33d-0410-90a0-b07cc1902cb9
  • Loading branch information
Kenzaburo Ito committed Jun 2, 2002
1 parent 3a7e37a commit 65b180e
Show file tree
Hide file tree
Showing 22 changed files with 432 additions and 55 deletions.
20 changes: 14 additions & 6 deletions bug_close.php
Expand Up @@ -17,15 +17,20 @@
check_bug_exists( $f_id );
$c_id = (integer)$f_id;

$t_handler_id = get_current_user_field( 'id' );
$t_handler_id = get_current_user_field( 'id' );

$h_status = get_bug_field( $c_id, 'status' );

# Update fields
$t_clo_val = CLOSED;
$query = "UPDATE $g_mantis_bug_table
SET status='$t_clo_val'
WHERE id='$f_id'";
WHERE id='$c_id'";
$result = db_query($query);

# log changes
history_log_event( $c_id, 'status', $h_status );

# get user information
$u_id = get_current_user_field( 'id' );

Expand All @@ -51,12 +56,15 @@
VALUES
( null, '$c_id', '$u_id','$t_bugnote_text_id', NOW(), NOW() )";
$result = db_query( $query );
}

# updated the last_updated date
$result = bug_date_update( $f_id );
# updated the last_updated date
$result = bug_date_update( $c_id );

email_close( $f_id );
# log new bugnote
history_log_event_special( $c_id, BUGNOTE_ADDED );

email_close( $c_id );
}

$t_redirect_url = $g_view_all_bug_page;
if ( $result ) {
Expand Down
6 changes: 6 additions & 0 deletions bug_delete.php
Expand Up @@ -80,6 +80,12 @@
WHERE bug_id='$c_id'";
$result = db_query($query);

# Delete the bug history
$query = "DELETE
FROM $g_mantis_bug_history_table
WHERE bug_id='$c_id'";
$result = db_query($query);

$t_redirect_url = $g_view_all_bug_page;
if ( $result ) {
print_header_redirect( $t_redirect_url );
Expand Down
3 changes: 3 additions & 0 deletions bug_file_add.php
Expand Up @@ -58,6 +58,9 @@

# updated the last_updated date
$result = bug_date_update( $f_id );

# log new file
history_log_event_special( $f_id, FILE_ADDED, $f_file_name );
}

# Determine which view page to redirect back to.
Expand Down
7 changes: 6 additions & 1 deletion bug_file_delete.php
Expand Up @@ -13,9 +13,11 @@
db_connect( $g_hostname, $g_db_username, $g_db_password, $g_database_name );
project_access_check( $f_id );
check_access( DEVELOPER );

$c_file_id = (integer)$f_file_id;

$t_file_name = get_file_field( $c_file_id, 'filename' );

if ( DISK == $g_file_upload_method ) {
# grab the file name
$query = "SELECT diskfile
Expand All @@ -33,6 +35,9 @@
WHERE id='$c_file_id'";
$result = db_query( $query );

# log file deletion
history_log_event_special( $f_id, FILE_DELETED, $t_file_name );

# Determine which view page to redirect back to.
$t_redirect_url = get_view_redirect_url( $f_id );
if ( $result ) {
Expand Down
23 changes: 17 additions & 6 deletions bug_reopen.php
Expand Up @@ -17,7 +17,10 @@
check_bug_exists( $f_id );
$c_id = (integer)$f_id;

$t_handler_id = get_current_user_field( 'id' );
$t_handler_id = get_current_user_field( 'id' );

$h_status = get_bug_field( $c_id, 'status' );
$h_resolution = get_bug_field( $c_id, 'resolution' );

# Update fields
$t_fee_val = FEEDBACK;
Expand All @@ -28,6 +31,10 @@
WHERE id='$c_id'";
$result = db_query($query);

# log changes
history_log_event( $c_id, 'status', $h_status );
history_log_event( $c_id, 'resolution', $h_resolution );

# get user information
$u_id = get_current_user_field( 'id' );

Expand All @@ -53,12 +60,16 @@
VALUES
( null, '$c_id', '$u_id','$t_bugnote_text_id', NOW(), NOW() )";
$result = db_query( $query );
}
# update bug last updated
$result = bug_date_update( $f_id );

# notify reporter and handler
email_reopen( $f_id );
# update bug last updated
$result = bug_date_update( $f_id );

# log new bugnote
history_log_event_special( $f_id, BUGNOTE_ADDED );

# notify reporter and handler
email_reopen( $f_id );
}

# Determine which view page to redirect back to.
$t_redirect_url = get_view_redirect_url( $f_id, 1 );
Expand Down
27 changes: 21 additions & 6 deletions bug_resolve.php
Expand Up @@ -20,7 +20,12 @@
$c_resolution = (integer)$f_resolution;
$c_duplicate_id = (integer)$f_duplicate_id;

$t_handler_id = get_current_user_field( 'id' );
$t_handler_id = get_current_user_field( 'id' );

$h_handler_id = get_bug_field( $c_id, 'handler_id' );
$h_status = get_bug_field( $c_id, 'status' );
$h_resolution = get_bug_field( $c_id, 'resolution' );
$h_duplicate_id = get_bug_field( $c_id, 'duplicate_id' );

# Update fields
$t_res_val = RESOLVED;
Expand All @@ -35,6 +40,12 @@
WHERE id='$c_id'";
$result = db_query($query);

# log changes
history_log_event( $c_id, 'handler_id', $h_handler_id );
history_log_event( $c_id, 'status', $h_status );
history_log_event( $c_id, 'resolution', $h_resolution );
history_log_event( $c_id, 'duplicate_id', $h_duplicate_id );

# get user information
$u_id = get_current_user_field( 'id' );

Expand All @@ -60,12 +71,16 @@
VALUES
( null, '$c_id', '$u_id','$t_bugnote_text_id', NOW(), NOW() )";
$result = db_query( $query );
}
# update bug last updated
$result = bug_date_update( $f_id );

# notify reporter and handler
email_resolved( $f_id );
# update bug last updated
$result = bug_date_update( $f_id );

# log new bugnote
history_log_event_special( $f_id, BUGNOTE_ADDED );

# notify reporter and handler
email_resolved( $f_id );
}

# Determine which view page to redirect back to.
$t_redirect_url = get_view_redirect_url( $f_id, 1 );
Expand Down
73 changes: 62 additions & 11 deletions bug_update.php
Expand Up @@ -31,18 +31,18 @@
}

# prevent warnings
check_varset( $f_os, get_bug_field( $f_id, 'os' ) );
check_varset( $f_os_build, get_bug_field( $f_id, 'os_build' ) );
check_varset( $f_platform, get_bug_field( $f_id, 'platform' ) );
check_varset( $f_version, get_bug_field( $f_id, 'version' ) );
check_varset( $f_build, get_bug_field( $f_id, 'build' ) );
check_varset( $f_eta, get_bug_field( $f_id, 'eta' ) );
check_varset( $f_os, get_bug_field( $f_id, 'os' ) );
check_varset( $f_os_build, get_bug_field( $f_id, 'os_build' ) );
check_varset( $f_platform, get_bug_field( $f_id, 'platform' ) );
check_varset( $f_version, get_bug_field( $f_id, 'version' ) );
check_varset( $f_build, get_bug_field( $f_id, 'build' ) );
check_varset( $f_eta, get_bug_field( $f_id, 'eta' ) );
check_varset( $f_projection, get_bug_field( $f_id, 'projection' ) );
check_varset( $f_resolution, get_bug_field( $f_id, 'resolution' ) );
check_varset( $f_os_build, get_bug_field( $f_id, 'os_build' ) );
check_varset( $f_os_build, get_bug_field( $f_id, 'os_build' ) );
check_varset( $f_os_build, get_bug_field( $f_id, 'os_build' ) );
check_varset( $f_os_build, get_bug_field( $f_id, 'os_build' ) );
check_varset( $f_os_build, get_bug_field( $f_id, 'os_build' ) );
check_varset( $f_os_build, get_bug_field( $f_id, 'os_build' ) );
check_varset( $f_os_build, get_bug_field( $f_id, 'os_build' ) );
check_varset( $f_os_build, get_bug_field( $f_id, 'os_build' ) );

if ( !isset( $f_steps_to_reproduce ) ) {
$c_steps_to_reproduce = get_bug_text_field( $f_id, 'steps_to_reproduce' );
Expand All @@ -60,8 +60,8 @@
$c_description = string_prepare_textarea( $f_description );
$c_additional_information = string_prepare_textarea( $f_additional_information );

$c_status = (integer)$f_status;
$c_category = addslashes($f_category);
$c_status = (integer)$f_status;
$c_severity = (integer)$f_severity;
$c_resolution = (integer)$f_resolution;
$c_projection = (integer)$f_projection;
Expand All @@ -73,6 +73,28 @@
$c_handler_id = (integer)$f_handler_id;
$c_view_state = (integer)$f_view_state;

$h_category = get_bug_field( $c_id, 'category' );
$h_severity = get_bug_field( $c_id, 'severity' );
$h_reproducibility = get_bug_field( $c_id, 'reproducibility' );
$h_priority = get_bug_field( $c_id, 'priority' );
$h_status = get_bug_field( $c_id, 'status' );
$h_projection = get_bug_field( $c_id, 'projection' );
$h_duplicate_id = get_bug_field( $c_id, 'duplicate_id' );
$h_resolution = get_bug_field( $c_id, 'resolution' );
$h_handler_id = get_bug_field( $c_id, 'handler_id' );
$h_eta = get_bug_field( $c_id, 'eta' );
$h_summary = get_bug_field( $c_id, 'summary' );
$h_os = get_bug_field( $c_id, 'os' );
$h_os_build = get_bug_field( $c_id, 'os_build' );
$h_platform = get_bug_field( $c_id, 'platform' );
$h_build = get_bug_field( $c_id, 'build' );
$h_version = get_bug_field( $c_id, 'version' );
$h_view_state = get_bug_field( $c_id, 'view_state' );

$h_description = string_prepare_textarea( get_bug_text_field( $c_id, 'description' ) );
$h_steps_to_reproduce = string_prepare_textarea( get_bug_text_field( $c_id, 'steps_to_reproduce' ) );
$h_additional_information = string_prepare_textarea( get_bug_text_field( $c_id, 'additional_information' ) );

# Update all fields
$query = "UPDATE $g_mantis_bug_table
SET category='$c_category',
Expand Down Expand Up @@ -102,6 +124,35 @@
WHERE id='$t_bug_text_id'";
$result = db_query($query);

# log changes
history_log_event( $c_id, 'category', $h_category );
history_log_event( $c_id, 'severity', $h_severity );
history_log_event( $c_id, 'reproducibility', $h_reproducibility );
history_log_event( $c_id, 'priority', $h_priority );
history_log_event( $c_id, 'status', $h_status );
history_log_event( $c_id, 'projection', $h_projection );
history_log_event( $c_id, 'duplicate_id', $h_duplicate_id );
history_log_event( $c_id, 'resolution', $h_resolution );
history_log_event( $c_id, 'handler_id', $h_handler_id );
history_log_event( $c_id, 'eta', $h_eta );
history_log_event( $c_id, 'summary', $h_summary );
history_log_event( $c_id, 'os', $h_os );
history_log_event( $c_id, 'os_build', $h_os_build );
history_log_event( $c_id, 'platform', $h_platform );
history_log_event( $c_id, 'build', $h_build );
history_log_event( $c_id, 'version', $h_version );
history_log_event( $c_id, 'view_state', $h_view_state );

if ( $h_description != $c_description ) {
history_log_event_special( $c_id, DESCRIPTION_UPDATED );
}
if ( $h_steps_to_reproduce != $c_steps_to_reproduce ) {
history_log_event_special( $c_id, STEP_TO_REPRODUCE_UPDATED );
}
if ( $h_additional_information != $c_additional_information ) {
history_log_event_special( $c_id, ADDITIONAL_INFO_UPDATED );
}

# updated the last_updated date
$result = bug_date_update( $f_id );

Expand Down
30 changes: 17 additions & 13 deletions bugnote_add.php
Expand Up @@ -41,20 +41,24 @@
VALUES
( null, '$c_id', '$u_id','$t_bugnote_text_id', NOW(), NOW() )";
$result = db_query( $query );
}
# update bug last updated
$result = bug_date_update( $f_id );

# notify reporter and handler
if ( get_bug_field( $f_id, 'status' ) == FEEDBACK ) {
if ( get_bug_field( $f_id, 'resolution' ) == REOPENED ) {
email_reopen( $f_id );
} else {
email_feedback( $f_id );
}
} else {
email_bugnote_add( $f_id );
}
# update bug last updated
$result = bug_date_update( $f_id );

# log new bug
history_log_event_special( $f_id, BUGNOTE_ADDED );

# notify reporter and handler
if ( get_bug_field( $f_id, 'status' ) == FEEDBACK ) {
if ( get_bug_field( $f_id, 'resolution' ) == REOPENED ) {
email_reopen( $f_id );
} else {
email_feedback( $f_id );
}
} else {
email_bugnote_add( $f_id );
}
}

# Determine which view page to redirect back to.
$t_redirect_url = get_view_redirect_url( $f_id, 1 );
Expand Down
3 changes: 3 additions & 0 deletions bugnote_delete.php
Expand Up @@ -36,6 +36,9 @@
WHERE id='$t_bugnote_text_id'";
$result = db_query( $query );

# log new bug
history_log_event_special( $f_id, BUGNOTE_DELETED );

# Determine which view page to redirect back to.
$t_redirect_url = get_view_redirect_url( $f_id );
if ( $result ) {
Expand Down
3 changes: 3 additions & 0 deletions bugnote_update.php
Expand Up @@ -27,6 +27,9 @@
# updated the last_updated date
bugnote_date_update( $f_bugnote_id );

# log new bug
history_log_event_special( $f_id, BUGNOTE_UPDATED );

# Determine which view page to redirect back to.
$t_redirect_url = get_bug_link_plain( $f_id );
if ( $result ) {
Expand Down
12 changes: 12 additions & 0 deletions constant_inc.php
Expand Up @@ -107,6 +107,18 @@
define( 'NO_ANONYMOUS', 2 );
define( 'ADMIN_ONLY', 3 );

define( 'NORMAL_TYPE', 0 );
define( 'NEW_BUG', 1 );
define( 'BUGNOTE_ADDED', 2 );
define( 'BUGNOTE_UPDATED', 3 );
define( 'BUGNOTE_DELETED', 4 );
define( 'SUMMARY_UPDATED', 5 );
define( 'DESCRIPTION_UPDATED', 6 );
define( 'ADDITIONAL_INFO_UPDATED', 7 );
define( 'STEP_TO_REPRODUCE_UPDATED', 8 );
define( 'FILE_ADDED', 9 );
define( 'FILE_DELETED', 10 );

# error messages
define( 'ERROR_GENERIC', 0 );
define( 'ERROR_SQL', 1 );
Expand Down
4 changes: 2 additions & 2 deletions core_API.php
Expand Up @@ -81,9 +81,9 @@
require( 'core_news_API.php' );
require( 'core_icon_API.php' );
require( 'core_ldap_API.php' );
#require( 'core_history_API.php' );
require( 'core_history_API.php' );
require( 'core_proj_user_API.php' );
require( 'core_category_API.php' );
require( 'core_version_API.php' );
# --------------------
?>
?>
13 changes: 13 additions & 0 deletions core_helper_API.php
Expand Up @@ -64,6 +64,19 @@ function get_bug_text_field( $p_bug_id, $p_field_name ) {
return db_result( $result, 0 );
}
# --------------------
# Returns the specified field value of the specified bug text
function get_file_field( $p_file_id, $p_field_name ) {
global $g_string_cookie_val,
$g_mantis_bug_file_table;

# get info
$query = "SELECT $p_field_name
FROM $g_mantis_bug_file_table
WHERE id='$p_file_id'";
$result = db_query( $query );
return db_result( $result, 0 );
}
# --------------------
# converts a 1 value to X
# converts a 0 value to a space
function trans_bool( $p_num ) {
Expand Down

0 comments on commit 65b180e

Please sign in to comment.