Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix #13816: Update history when copying issues
Until now, copying bugs using the "View Issues" page creates wrong/
incomplete history (entries for notes reflect the id's of the original
issue's notes) and also does not record any trace that the new issue is
in fact clone of another, which can be a source of confusion.

This commit prevents the duplication of the original bug's history,
generating instead a single history entry similar to what happens when
cloning a bug with the Clone button in view.php page.

The display of history entries for cloned bugs has been slightly
modified, the bug id is now printed under the 'Field' column instead of
the 'Change' column, like entries for adding notes (as cloning s not a
change).
  • Loading branch information
dregad committed Mar 1, 2012
1 parent 643de3f commit dd634e7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
3 changes: 2 additions & 1 deletion bug_actiongroup.php
Expand Up @@ -112,7 +112,8 @@
$f_project_id = gpc_get_int( 'project_id' );

if ( access_has_project_level( config_get( 'report_bug_threshold' ), $f_project_id ) ) {
bug_copy( $t_bug_id, $f_project_id, true, true, true, true, true, true );
# Copy everything except history
bug_copy( $t_bug_id, $f_project_id, true, true, false, true, true, true );
} else {
$t_failed_ids[$t_bug_id] = lang_get( 'bug_actiongroup_access' );
}
Expand Down
8 changes: 8 additions & 0 deletions core/bug_api.php
Expand Up @@ -892,6 +892,10 @@ function bug_check_workflow( $p_bug_status, $p_wanted_status ) {
* @param int p_target_project_id
* @param bool p_copy_custom_fields
* @param bool p_copy_relationships
* @param bool p_copy_history
* @param bool p_copy_attachments
* @param bool p_copy_bugnotes
* @param bool p_copy_monitoring_users
* @return int representing the new bugid
* @access public
*/
Expand Down Expand Up @@ -1039,6 +1043,10 @@ function bug_copy( $p_bug_id, $p_target_project_id = null, $p_copy_custom_fields
}
}

# 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 );

return $t_new_bug_id;
}

Expand Down
6 changes: 2 additions & 4 deletions core/history_api.php
Expand Up @@ -516,12 +516,10 @@ function history_localize_item( $p_field_name, $p_type, $p_old_value, $p_new_val
}
break;
case BUG_CLONED_TO:
$t_note = lang_get( 'bug_cloned_to' );
$t_change = bug_format_id( $p_new_value );
$t_note = lang_get( 'bug_cloned_to' ) . ': ' . bug_format_id( $p_new_value );
break;
case BUG_CREATED_FROM:
$t_note = lang_get( 'bug_created_from' );
$t_change = bug_format_id( $p_new_value );
$t_note = lang_get( 'bug_created_from' ) . ': ' . bug_format_id( $p_new_value );
break;
case CHECKIN:
$t_note = lang_get( 'checkin' );
Expand Down

0 comments on commit dd634e7

Please sign in to comment.