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 dd634e7 commit 38e23e3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions core/bug_api.php
Expand Up @@ -1022,6 +1022,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 @@ -1041,8 +1043,12 @@ 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
history_log_event_special( $t_new_bug_id, BUG_CREATED_FROM, '', $t_bug_id );
history_log_event_special( $t_bug_id, BUG_CLONED_TO, '', $t_new_bug_id );
Expand Down

0 comments on commit 38e23e3

Please sign in to comment.