Skip to content

Commit

Permalink
Enh #3925: New bug group action: Copy.
Browse files Browse the repository at this point in the history
git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/trunk@2602 f5dc347c-c33d-0410-90a0-b07cc1902cb9
  • Loading branch information
narcissus committed Jun 11, 2004
1 parent 0e57451 commit 371c346
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 7 deletions.
63 changes: 62 additions & 1 deletion bug_actiongroup.php
Expand Up @@ -6,7 +6,7 @@
# See the README and LICENSE files for details

# --------------------------------------------------------
# $Id: bug_actiongroup.php,v 1.29 2004-05-18 12:28:49 vboctor Exp $
# $Id: bug_actiongroup.php,v 1.30 2004-06-11 02:00:00 narcissus Exp $
# --------------------------------------------------------
?>
<?php
Expand Down Expand Up @@ -56,6 +56,67 @@
}
break;

case 'COPY':
$f_project_id = gpc_get_int( 'project_id' );

if ( access_has_project_level( config_get( 'report_bug_threshold' ), $f_project_id ) ) {
$t_bug_data = new BugData;
$t_bug_data = bug_get($t_bug_id, true);

$t_new_bug_id = bug_create(
/* Change project */
$f_project_id,
$t_bug_data->reporter_id,
$t_bug_data->handler_id,
$t_bug_data->priority,
$t_bug_data->severity,
$t_bug_data->reproducibility,
$t_bug_data->category,
$t_bug_data->os,
$t_bug_data->os_build,
$t_bug_data->platform,
$t_bug_data->version,
$t_bug_data->build,
bug_get_field( $t_bug_id, 'profile_id' ),
$t_bug_data->summary,
$t_bug_data->view_state,
$t_bug_data->description,
$t_bug_data->steps_to_reproduce,
$t_bug_data->additional_information );

bug_set_field( $t_new_bug_id, 'duplicate_id', bug_get_field( $t_bug_id, 'duplicate_id' ) );
bug_set_field( $t_new_bug_id, 'status', bug_get_field( $t_bug_id, 'status' ) );
bug_set_field( $t_new_bug_id, 'resolution', bug_get_field( $t_bug_id, 'resolution' ) );
bug_set_field( $t_new_bug_id, 'projection', bug_get_field( $t_bug_id, 'projection' ) );
bug_set_field( $t_new_bug_id, 'date_submitted', bug_get_field( $t_bug_id, 'date_submitted' ) );
bug_set_field( $t_new_bug_id, 'last_updated', bug_get_field( $t_bug_id, 'last_updated' ) );
bug_set_field( $t_new_bug_id, 'eta', bug_get_field( $t_bug_id, 'eta' ) );
bug_set_field( $t_new_bug_id, 'fixed_in_version', bug_get_field( $t_bug_id, 'fixed_in_version' ) );
bug_set_field( $t_new_bug_id, 'sponsorship_total', bug_get_field( $t_bug_id, 'sponsorship_total' ) );

# Get custom field values
$query = "SELECT field_id, bug_id, value
FROM mantis_custom_field_string_table
WHERE bug_id = '$t_bug_id';";
$result = db_query( $query );
$t_count = db_num_rows( $result );

$t_bug_customs = array();
for ( $i = 0 ; $i < $t_count ; $i++ ) {
$t_bug_customs[] = db_fetch_array( $result );
}

foreach( $t_bug_customs as $t_bug_custom ) {
$query = "INSERT INTO `mantis_custom_field_string_table`
(`field_id`, `bug_id`, `value`)
VALUES ('" . $t_bug_custom['field_id'] . "', '$t_new_bug_id', '" . $t_bug_custom['value'] . "');";
db_query( $query );
}
} else {
$t_failed_ids[] = $t_bug_id;
}
break;

case 'ASSIGN':
if ( access_has_bug_level( config_get( 'update_bug_threshold' ), $t_bug_id ) ) {
// @@@ Check that $f_assign has access to handle a bug.
Expand Down
9 changes: 8 additions & 1 deletion bug_actiongroup_page.php
Expand Up @@ -6,7 +6,7 @@
# See the README and LICENSE files for details

# --------------------------------------------------------
# $Id: bug_actiongroup_page.php,v 1.38 2004-05-27 23:11:00 vboctor Exp $
# $Id: bug_actiongroup_page.php,v 1.39 2004-06-11 02:00:00 narcissus Exp $
# --------------------------------------------------------
?>
<?php
Expand Down Expand Up @@ -47,6 +47,12 @@
$t_form = 'project_id';
break;

case 'COPY' :
$t_question_title = lang_get( 'copy_bugs_conf_msg' );
$t_button_title = lang_get( 'copy_group_bugs_button' );
$t_form = 'project_id';
break;

case 'ASSIGN' :
$t_question_title = lang_get( 'assign_bugs_conf_msg' );
$t_button_title = lang_get( 'assign_group_bugs_button' );
Expand Down Expand Up @@ -120,6 +126,7 @@
<select name="<?php echo $t_form ?>">
<?php
switch ( $f_action ) {
case 'COPY':
case 'MOVE':
print_project_option_list( null, false );
break;
Expand Down
3 changes: 2 additions & 1 deletion core/print_api.php
Expand Up @@ -6,7 +6,7 @@
# See the README and LICENSE files for details

# --------------------------------------------------------
# $Id: print_api.php,v 1.86 2004-05-30 01:49:31 vboctor Exp $
# $Id: print_api.php,v 1.87 2004-06-11 02:00:01 narcissus Exp $
# --------------------------------------------------------

$t_core_dir = dirname( __FILE__ ).DIRECTORY_SEPARATOR;
Expand Down Expand Up @@ -641,6 +641,7 @@ function print_language_option_list( $p_language ) {
# @@@ preliminary support for multiple bug actions.
function print_all_bug_action_option_list() {
$commands = array( 'MOVE' => lang_get('actiongroup_menu_move'),
'COPY' => lang_get('actiongroup_menu_copy'),
'ASSIGN' => lang_get('actiongroup_menu_assign'),
'CLOSE' => lang_get('actiongroup_menu_close'),
'DELETE' => lang_get('actiongroup_menu_delete'),
Expand Down
1 change: 1 addition & 0 deletions doc/ChangeLog
Expand Up @@ -31,6 +31,7 @@ Mantis ChangeLog
* Enh #3867: Give the user control whether to open hyperlink in new or current window.
* Enh #3870: Support for custom functions which provides hooks for customizing behaviour.
* Enh #3918: Allow restricting filter views to advanced or simple.
* Enh #3925: New bug group action: Copy.
* Fix #3094: Switching projects clears filter values.
* Fix #3159: Allow case of user name to be changed. Also fixed bug where database error was displayed when trying to create user "TeSt" when user "Test" already exists.
* Fix #3397: Delete notification should be off when deleting a project.
Expand Down
11 changes: 7 additions & 4 deletions lang/strings_english.txt
Expand Up @@ -9,11 +9,11 @@
###########################################################################
# English strings for Mantis
# -------------------------------------------------
# $Revision: 1.176 $
# $Author: int2str $
# $Date: 2004-05-26 04:45:08 $
# $Revision: 1.177 $
# $Author: narcissus $
# $Date: 2004-06-11 02:00:01 $
#
# $Id: strings_english.txt,v 1.176 2004-05-26 04:45:08 int2str Exp $
# $Id: strings_english.txt,v 1.177 2004-06-11 02:00:01 narcissus Exp $
###########################################################################
?>
<?php
Expand All @@ -22,6 +22,7 @@ $s_charset = 'windows-1252';

# Group commands menuitems
$s_actiongroup_menu_move = 'Move';
$s_actiongroup_menu_copy = 'Copy';
$s_actiongroup_menu_assign = 'Assign';
$s_actiongroup_menu_close = 'Close';
$s_actiongroup_menu_delete = 'Delete';
Expand Down Expand Up @@ -100,6 +101,7 @@ $s_bug_actiongroup_failed = 'You did not have appropriate permissions to perform
$s_close_bugs_conf_msg = 'Are you sure you wish to close these issues?';
$s_delete_bugs_conf_msg = 'Are you sure you wish to delete these issues?';
$s_move_bugs_conf_msg = 'Move issues to';
$s_copy_bugs_conf_msg = 'Copy issues to';
$s_assign_bugs_conf_msg = 'Assign issues to';
$s_resolve_bugs_conf_msg = 'Choose issues resolution';
$s_priority_bugs_conf_msg = 'Choose issues priority';
Expand All @@ -108,6 +110,7 @@ $s_view_status_bugs_conf_msg = 'Choose issues view status';
$s_close_group_bugs_button = 'Close Issues' ;
$s_delete_group_bugs_button = 'Delete Issues' ;
$s_move_group_bugs_button = 'Move Issues' ;
$s_copy_group_bugs_button = 'Copy Issues' ;
$s_assign_group_bugs_button = 'Assign Issues' ;
$s_resolve_group_bugs_button = 'Resolve Issues' ;
$s_priority_group_bugs_button = 'Update Priority' ;
Expand Down

0 comments on commit 371c346

Please sign in to comment.