Permalink
Browse files

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 3f91f58 commit cf5df427f17cf9204645f83e000665780eb9afe6
Showing with 12 additions and 5 deletions.
  1. +2 −1 bug_actiongroup.php
  2. +8 −0 core/bug_api.php
  3. +2 −4 core/history_api.php
View
@@ -150,7 +150,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' );
}
View
@@ -907,6 +907,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
*/
@@ -1054,6 +1058,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;
}
View
@@ -556,12 +556,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 TAG_ATTACHED:
$t_note = lang_get( 'tag_history_attached' ) . ': ' . $p_old_value;

0 comments on commit cf5df42

Please sign in to comment.