Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit dd634e7

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 643de3f commit dd634e7

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
@@ -112,7 +112,8 @@
112112
$f_project_id = gpc_get_int( 'project_id' );
113113

114114
if ( access_has_project_level( config_get( 'report_bug_threshold' ), $f_project_id ) ) {
115-
bug_copy( $t_bug_id, $f_project_id, true, true, true, true, true, true );
115+
# Copy everything except history
116+
bug_copy( $t_bug_id, $f_project_id, true, true, false, true, true, true );
116117
} else {
117118
$t_failed_ids[$t_bug_id] = lang_get( 'bug_actiongroup_access' );
118119
}

‎core/bug_api.php

+8
Original file line numberDiff line numberDiff line change
@@ -892,6 +892,10 @@ function bug_check_workflow( $p_bug_status, $p_wanted_status ) {
892892
* @param int p_target_project_id
893893
* @param bool p_copy_custom_fields
894894
* @param bool p_copy_relationships
895+
* @param bool p_copy_history
896+
* @param bool p_copy_attachments
897+
* @param bool p_copy_bugnotes
898+
* @param bool p_copy_monitoring_users
895899
* @return int representing the new bugid
896900
* @access public
897901
*/
@@ -1039,6 +1043,10 @@ function bug_copy( $p_bug_id, $p_target_project_id = null, $p_copy_custom_fields
10391043
}
10401044
}
10411045

1046+
# Create history entries to reflect the copy operation
1047+
history_log_event_special( $t_new_bug_id, BUG_CREATED_FROM, '', $t_bug_id );
1048+
history_log_event_special( $t_bug_id, BUG_CLONED_TO, '', $t_new_bug_id );
1049+
10421050
return $t_new_bug_id;
10431051
}
10441052

‎core/history_api.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -516,12 +516,10 @@ function history_localize_item( $p_field_name, $p_type, $p_old_value, $p_new_val
516516
}
517517
break;
518518
case BUG_CLONED_TO:
519-
$t_note = lang_get( 'bug_cloned_to' );
520-
$t_change = bug_format_id( $p_new_value );
519+
$t_note = lang_get( 'bug_cloned_to' ) . ': ' . bug_format_id( $p_new_value );
521520
break;
522521
case BUG_CREATED_FROM:
523-
$t_note = lang_get( 'bug_created_from' );
524-
$t_change = bug_format_id( $p_new_value );
522+
$t_note = lang_get( 'bug_created_from' ) . ': ' . bug_format_id( $p_new_value );
525523
break;
526524
case CHECKIN:
527525
$t_note = lang_get( 'checkin' );

0 commit comments

Comments
 (0)
Please sign in to comment.