Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
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...
commit 263d760cda30c470173d99921eaf5226e5532760 1 parent fa7ffff
@rombert rombert authored
Showing with 40 additions and 2 deletions.
  1. +24 −1 bug_report.php
  2. +13 −1 bug_report_page.php
  3. +3 −0  lang/strings_english.txt
View
25 bug_report.php
@@ -67,7 +67,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_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();
@@ -171,6 +174,26 @@
# Send the email notification
email_relationship_added( $f_master_bug_id, $t_bug_id, relationship_get_complementary_type( $f_rel_type ) );
}
+
+ # 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 , /* 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
14 bug_report_page.php
@@ -124,7 +124,9 @@
$t_changed_project = false;
}
- $f_report_stay = gpc_get_bool( 'report_stay', false );
+ $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 );
@@ -500,6 +502,16 @@
<?php echo '<b>' . lang_get( 'bug' ) . ' ' . bug_format_id( $f_master_bug_id ) . '</b>' ?>
</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
3  lang/strings_english.txt
@@ -1372,6 +1372,9 @@ $s_relationship_warning_blocking_bugs_not_resolved_2 = '<b>Attention:</b> Not al
$s_create_child_bug_button = 'Clone';
$s_bug_cloned_to = 'Issue cloned';
$s_bug_created_from = 'Issue generated from';
+$s_copy_from_parent = 'Copy extended data from parent issue';
+$s_copy_notes_from_parent = 'Copy bug notes';
+$s_copy_attachments_from_parent = 'Copy attachments';
# Relationship Graphs
$s_viewing_bug_relationship_graph_title = 'Relationship Graph';
Please sign in to comment.
Something went wrong with that request. Please try again.