Permalink
Browse files

Add "New Issue" entry to history when copying bugs

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 dea7e315f3fc96dfa995e56e8810845fc07a47aa
Showing with 5 additions and 0 deletions.
  1. +5 −0 core/bug_api.php
View
@@ -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();
@@ -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

0 comments on commit dea7e31

Please sign in to comment.