Skip to content

Commit cf5df42

Browse files
committedMar 1, 2012
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).
1 parent 3f91f58 commit cf5df42

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed
 

‎bug_actiongroup.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,8 @@
150150
$f_project_id = gpc_get_int( 'project_id' );
151151

152152
if ( access_has_project_level( config_get( 'report_bug_threshold' ), $f_project_id ) ) {
153-
bug_copy( $t_bug_id, $f_project_id, true, true, true, true, true, true );
153+
# Copy everything except history
154+
bug_copy( $t_bug_id, $f_project_id, true, true, false, true, true, true );
154155
} else {
155156
$t_failed_ids[$t_bug_id] = lang_get( 'bug_actiongroup_access' );
156157
}

‎core/bug_api.php

+8
Original file line numberDiff line numberDiff line change
@@ -907,6 +907,10 @@ function bug_check_workflow( $p_bug_status, $p_wanted_status ) {
907907
* @param int p_target_project_id
908908
* @param bool p_copy_custom_fields
909909
* @param bool p_copy_relationships
910+
* @param bool p_copy_history
911+
* @param bool p_copy_attachments
912+
* @param bool p_copy_bugnotes
913+
* @param bool p_copy_monitoring_users
910914
* @return int representing the new bugid
911915
* @access public
912916
*/
@@ -1054,6 +1058,10 @@ function bug_copy( $p_bug_id, $p_target_project_id = null, $p_copy_custom_fields
10541058
}
10551059
}
10561060

1061+
# Create history entries to reflect the copy operation
1062+
history_log_event_special( $t_new_bug_id, BUG_CREATED_FROM, '', $t_bug_id );
1063+
history_log_event_special( $t_bug_id, BUG_CLONED_TO, '', $t_new_bug_id );
1064+
10571065
return $t_new_bug_id;
10581066
}
10591067

‎core/history_api.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -556,12 +556,10 @@ function history_localize_item( $p_field_name, $p_type, $p_old_value, $p_new_val
556556
}
557557
break;
558558
case BUG_CLONED_TO:
559-
$t_note = lang_get( 'bug_cloned_to' );
560-
$t_change = bug_format_id( $p_new_value );
559+
$t_note = lang_get( 'bug_cloned_to' ) . ': ' . bug_format_id( $p_new_value );
561560
break;
562561
case BUG_CREATED_FROM:
563-
$t_note = lang_get( 'bug_created_from' );
564-
$t_change = bug_format_id( $p_new_value );
562+
$t_note = lang_get( 'bug_created_from' ) . ': ' . bug_format_id( $p_new_value );
565563
break;
566564
case TAG_ATTACHED:
567565
$t_note = lang_get( 'tag_history_attached' ) . ': ' . $p_old_value;

0 commit comments

Comments
 (0)
Please sign in to comment.