Skip to content

Commit

Permalink
Add "New Issue" entry to history when copying bugs
Browse files Browse the repository at this point in the history
When bug_copy() is called with p_copy_history=false, a 'NEW_BUG' history
entry is added to ensure consistency of behavior with Clone button.

Fixes #13816
  • Loading branch information
dregad committed Mar 2, 2012
1 parent cf5df42 commit dea7e31
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions core/bug_api.php
Expand Up @@ -1037,6 +1037,8 @@ function bug_copy( $p_bug_id, $p_target_project_id = null, $p_copy_custom_fields
# COPY HISTORY
history_delete( $t_new_bug_id ); # should history only be deleted inside the if statement below?
if( $p_copy_history ) {
# @todo problem with this code: the generated history trail is incorrect because the note IDs are those of the original bug, not the copied ones
# @todo actually, does it even make sense to copy the history ?
$query = "SELECT *
FROM $t_mantis_bug_history_table
WHERE bug_id = " . db_param();
Expand All @@ -1056,6 +1058,9 @@ function bug_copy( $p_bug_id, $p_target_project_id = null, $p_copy_custom_fields
" . db_param() . " );";
db_query_bound( $query, Array( $t_bug_history['user_id'], $t_new_bug_id, $t_bug_history['date_modified'], $t_bug_history['field_name'], $t_bug_history['old_value'], $t_bug_history['new_value'], $t_bug_history['type'] ) );
}
} else {
# Create a "New Issue" history entry
history_log_event_special( $t_new_bug_id, NEW_BUG );
}

# Create history entries to reflect the copy operation
Expand Down

0 comments on commit dea7e31

Please sign in to comment.