Permalink
Browse files

Bug cloning: allow copying of notes and attachments from parent bug

Fixes #13167 : Clone task: allow copying of notes
Fixes #10367 : Moving attachments while cloning issue
  • Loading branch information...
rombert committed Jul 24, 2011
1 parent 6364db6 commit e39645d7e61df318e84c6b409d3f1a87779f11eb
Showing with 40 additions and 0 deletions.
  1. +25 −0 bug_report.php
  2. +12 −0 bug_report_page.php
  3. +3 −0 lang/strings_english.txt
View
@@ -114,6 +114,10 @@
$f_file = gpc_get_file( 'file', null ); /** @todo (thraxisp) Note that this always returns a structure */
# size = 0, if no file
$f_report_stay = gpc_get_bool( 'report_stay', false );
+$f_copy_notes_from_parent = gpc_get_bool( 'copy_notes_from_parent', false);
+$f_copy_attachments_from_parent = gpc_get_bool( 'copy_attachments_from_parent', false);
+
+
$t_bug_data->project_id = gpc_get_int( 'project_id' );
$t_bug_data->reporter_id = auth_get_current_user_id();
@@ -220,6 +224,27 @@
# update relationship target bug last updated
bug_update_date( $t_bug_id );
}
+
+ # copy notes from parent
+ if ( $f_copy_notes_from_parent ) {
+
+ $t_parent_bugnotes = bugnote_get_all_bugnotes( $f_master_bug_id );
+
+ foreach ( $t_parent_bugnotes as $t_parent_bugnote ) {
+
+ $t_private = $t_parent_bugnote->view_state == VS_PRIVATE;
+
+ bugnote_add( $t_bug_id, $t_parent_bugnote->note, $t_parent_bugnote->time_tracking,
+ $t_private, $t_parent_bugnote->note_type, $t_parent_bugnote->note_attr,
+ $t_parent_bugnote->reporter_id, /* send_email */ FALSE , /* date submitted */ 0,
+ /* date modified */ 0, /* log history */ FALSE);
+ }
+ }
+
+ # copy attachments from parent
+ if ( $f_copy_attachments_from_parent ) {
+ file_copy_attachments( $f_master_bug_id, $t_bug_id );
+ }
}
helper_call_custom_function( 'issue_create_notify', array( $t_bug_id ) );
View
@@ -169,6 +169,8 @@
}
$f_report_stay = gpc_get_bool( 'report_stay', false );
+$f_copy_notes_from_parent = gpc_get_bool( 'copy_notes_from_parent', false);
+$f_copy_attachments_from_parent = gpc_get_bool( 'copy_attachments_from_parent', false);
$t_fields = config_get( 'bug_report_page_fields' );
$t_fields = columns_filter_disabled( $t_fields );
@@ -555,6 +557,16 @@
<?php echo '<strong>' . lang_get( 'bug' ) . ' ' . bug_format_id( $f_master_bug_id ) . '</strong>' ?>
</td>
</tr>
+
+ <tr <?php echo helper_alternate_class() ?>>
+ <td class="category">
+ <?php echo lang_get( 'copy_from_parent' ) ?>
+ </td>
+ <td>
+ <label><input <?php echo helper_get_tab_index() ?> type="checkbox" id="copy_notes_from_parent" name="copy_notes_from_parent" <?php check_checked( $f_copy_notes_from_parent ) ?> /> <?php echo lang_get( 'copy_notes_from_parent' ) ?></label>
+ <label><input <?php echo helper_get_tab_index() ?> type="checkbox" id="copy_attachments_from_parent" name="copy_attachments_from_parent" <?php check_checked( $f_copy_attachments_from_parent ) ?> /> <?php echo lang_get( 'copy_attachments_from_parent' ) ?></label>
+ </td>
+ </tr>
<?php
}
?>
View
@@ -1294,6 +1294,9 @@ If you requested this verification, visit the following URL to change your passw
'create_child_bug_button' => 'Clone',
'bug_cloned_to' => 'Issue cloned',
'bug_created_from' => 'Issue generated from',
+ 'copy_from_parent' => 'Copy extended data from parent issue',
+ 'copy_notes_from_parent' => 'Copy bug notes',
+ 'copy_attachments_from_parent' => 'Copy attachments',
# Relationship Graphs
'viewing_bug_relationship_graph_title' => 'Relationship Graph',

0 comments on commit e39645d

Please sign in to comment.