From dc28294ddb72ad284b38dbd8621bf8e8f657424b Mon Sep 17 00:00:00 2001 From: Matt McCutchen Date: Fri, 16 Apr 2010 10:44:00 +0200 Subject: [PATCH 1/2] Allow mass update of 'Product Version' field Implement an option to update the 'Product Version' field for multiple bugs at once in view.php, similar to existing options for 'Target' and 'Fixed in' version fields. Signed-off-by: Damien Regad --- bug_actiongroup.php | 17 +++++++++++++++++ bug_actiongroup_page.php | 7 +++++++ core/bug_group_action_api.php | 6 ++++++ lang/strings_english.txt | 3 +++ 4 files changed, 33 insertions(+) diff --git a/bug_actiongroup.php b/bug_actiongroup.php index ab5afa9..bee1bbb 100644 --- a/bug_actiongroup.php +++ b/bug_actiongroup.php @@ -217,6 +217,23 @@ } break; + case 'UP_PRODUCT_VERSION': + $f_product_version = gpc_get_string( 'product_version' ); + $t_project_id = bug_get_field( $t_bug_id, 'project_id' ); + + if ( access_has_bug_level( config_get( 'update_bug_threshold' ), $t_bug_id ) ) { + if ( $f_product_version === '' || version_get_id( $f_product_version, $t_project_id ) !== false ) { + /** @todo we need to issue a helper_call_custom_function( 'issue_update_validate', array( $t_bug_id, $t_bug_data, $f_bugnote_text ) ); */ + bug_set_field( $t_bug_id, 'version', $f_product_version ); + helper_call_custom_function( 'issue_update_notify', array( $t_bug_id ) ); + } else { + $t_failed_ids[$t_bug_id] = lang_get( 'bug_actiongroup_version' ); + } + } else { + $t_failed_ids[$t_bug_id] = lang_get( 'bug_actiongroup_access' ); + } + break; + case 'UP_FIXED_IN_VERSION': $f_fixed_in_version = gpc_get_string( 'fixed_in_version' ); $t_project_id = bug_get_field( $t_bug_id, 'project_id' ); diff --git a/bug_actiongroup_page.php b/bug_actiongroup_page.php index 8f46abd..7912cbc 100644 --- a/bug_actiongroup_page.php +++ b/bug_actiongroup_page.php @@ -173,6 +173,12 @@ $t_form = 'view_status'; break; + case 'UP_PRODUCT_VERSION': + $t_question_title = lang_get( 'product_version_bugs_conf_msg' ); + $t_button_title = lang_get( 'product_version_group_bugs_button' ); + $t_form = 'product_version'; + break; + case 'UP_FIXED_IN_VERSION': $t_question_title = lang_get( 'fixed_in_version_bugs_conf_msg' ); $t_button_title = lang_get( 'fixed_in_version_group_bugs_button' ); @@ -264,6 +270,7 @@ if ( !$t_finished ) { case 'VIEW_STATUS': print_enum_string_option_list( 'view_state', config_get( 'default_bug_view_status' ) ); break; + case 'UP_PRODUCT_VERSION': case 'UP_TARGET_VERSION': case 'UP_FIXED_IN_VERSION': print_version_option_list( '', $t_project_id, VERSION_ALL, diff --git a/core/bug_group_action_api.php b/core/bug_group_action_api.php index 49adbef..a715dee 100644 --- a/core/bug_group_action_api.php +++ b/core/bug_group_action_api.php @@ -258,6 +258,12 @@ function bug_group_action_get_commands( $p_project_ids = null ) { $t_commands['EXT_ATTACH_TAGS'] = lang_get( 'actiongroup_menu_attach_tags' ); } + if( !isset( $t_commands['UP_PRODUCT_VERSION'] ) && + version_should_show_product_version( $t_project_id ) && + access_has_project_level( config_get( 'update_bug_threshold', null, null, $t_project_id ), $t_project_id ) ) { + $t_commands['UP_PRODUCT_VERSION'] = lang_get( 'actiongroup_menu_update_product_version' ); + } + if( !isset( $t_commands['UP_FIXED_IN_VERSION'] ) && version_should_show_product_version( $t_project_id ) && access_has_project_level( config_get( 'update_bug_threshold', null, null, $t_project_id ), $t_project_id ) ) { diff --git a/lang/strings_english.txt b/lang/strings_english.txt index 73a46a2..1fe78b8 100644 --- a/lang/strings_english.txt +++ b/lang/strings_english.txt @@ -47,6 +47,7 @@ $s_actiongroup_menu_update_view_status = 'Update View Status'; $s_actiongroup_menu_update_category = 'Update Category'; $s_actiongroup_menu_set_sticky = 'Set/Unset Sticky'; $s_actiongroup_menu_update_field = 'Update %1$s'; +$s_actiongroup_menu_update_product_version = 'Update Product Version'; $s_actiongroup_menu_update_target_version = 'Update Target Version'; $s_actiongroup_menu_update_fixed_in_version = 'Update Fixed in Version'; $s_actiongroup_menu_update_product_build = 'Update Product Build'; @@ -152,6 +153,7 @@ $s_status_bugs_conf_msg = 'Choose issues status'; $s_view_status_bugs_conf_msg = 'Choose issues view status'; $s_category_bugs_conf_msg = 'Choose issues category'; $s_set_sticky_bugs_conf_msg = 'Are you sure you wish to set/unset these issues sticky?'; +$s_product_version_bugs_conf_msg = 'Update Product Version to'; $s_fixed_in_version_bugs_conf_msg = 'Update Fixed in Version to'; $s_target_version_bugs_conf_msg = 'Update Target Version to'; $s_close_group_bugs_button = 'Close Issues'; @@ -165,6 +167,7 @@ $s_status_group_bugs_button = 'Update Status'; $s_category_group_bugs_button = 'Update Category'; $s_view_status_group_bugs_button = 'Update View Status'; $s_set_sticky_group_bugs_button = 'Set/Unset Sticky'; +$s_product_version_group_bugs_button = 'Update Product Version'; $s_fixed_in_version_group_bugs_button = 'Update Fixed in Version'; $s_target_version_group_bugs_button = 'Update Target Version'; $s_update_severity_title = 'Update Severity'; -- 2.1.0