diff --git a/bug_actiongroup.php b/bug_actiongroup.php index 572dd4fc9f..7868d6b56f 100644 --- a/bug_actiongroup.php +++ b/bug_actiongroup.php @@ -158,7 +158,7 @@ } # check that new handler has rights to handle the issue, and # that current user has rights to assign the issue - $t_threshold = access_get_status_threshold( $t_assign_status, bug_get_field( $t_bug_id, 'project_id' ) ); + $t_threshold = access_get_status_threshold( $t_assign_status, $t_bug->project_id ); if( access_has_bug_level( config_get( 'update_bug_assign_threshold', config_get( 'update_bug_threshold' ) ), $t_bug_id ) ) { if( access_has_bug_level( config_get( 'handle_bug_threshold' ), $t_bug_id, $f_assign ) ) { if( bug_check_workflow( $t_status, $t_assign_status ) ) { @@ -177,7 +177,7 @@ break; case 'RESOLVE': $t_resolved_status = config_get( 'bug_resolved_status_threshold' ); - if( access_has_bug_level( access_get_status_threshold( $t_resolved_status, bug_get_field( $t_bug_id, 'project_id' ) ), $t_bug_id ) ) { + if( access_has_bug_level( access_get_status_threshold( $t_resolved_status, $t_bug->project_id ), $t_bug_id ) ) { if( ( $t_status < $t_resolved_status ) && bug_check_workflow( $t_status, $t_resolved_status ) ) { $f_resolution = gpc_get_int( 'resolution' ); @@ -205,8 +205,7 @@ break; case 'UP_STATUS': $f_status = gpc_get_int( 'status' ); - $t_project = bug_get_field( $t_bug_id, 'project_id' ); - if( access_has_bug_level( access_get_status_threshold( $f_status, $t_project ), $t_bug_id ) ) { + if( access_has_bug_level( access_get_status_threshold( $f_status, $t_bug->project_id ), $t_bug_id ) ) { if( true == bug_check_workflow( $t_status, $f_status ) ) { # @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, 'status', $f_status ); @@ -242,12 +241,25 @@ $t_failed_ids[$t_bug_id] = lang_get( 'bug_actiongroup_access' ); } break; + case 'UP_PRODUCT_VERSION': + $f_product_version = gpc_get_string( 'product_version' ); + if( access_has_bug_level( config_get( 'update_bug_threshold' ), $t_bug_id ) ) { + if( $f_product_version === '' || version_get_id( $f_product_version, $t_bug->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 ); + email_generic( $t_bug_id, 'updated', 'email_notification_title_for_action_bug_updated' ); + 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' ); - if( access_has_bug_level( config_get( 'update_bug_threshold' ), $t_bug_id ) ) { - if( $f_fixed_in_version === '' || version_get_id( $f_fixed_in_version, $t_project_id ) !== false ) { + if( $f_fixed_in_version === '' || version_get_id( $f_fixed_in_version, $t_bug->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, 'fixed_in_version', $f_fixed_in_version ); email_generic( $t_bug_id, 'updated', 'email_notification_title_for_action_bug_updated' ); @@ -261,10 +273,8 @@ break; case 'UP_TARGET_VERSION': $f_target_version = gpc_get_string( 'target_version' ); - $t_project_id = bug_get_field( $t_bug_id, 'project_id' ); - if( access_has_bug_level( config_get( 'roadmap_update_threshold' ), $t_bug_id ) ) { - if( $f_target_version === '' || version_get_id( $f_target_version, $t_project_id ) !== false ) { + if( $f_target_version === '' || version_get_id( $f_target_version, $t_bug->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, 'target_version', $f_target_version ); email_generic( $t_bug_id, 'updated', 'email_notification_title_for_action_bug_updated' ); diff --git a/bug_actiongroup_page.php b/bug_actiongroup_page.php index 1d6d83dca0..5a8b5d2040 100644 --- a/bug_actiongroup_page.php +++ b/bug_actiongroup_page.php @@ -192,6 +192,11 @@ $t_button_title = lang_get( 'view_status_group_bugs_button' ); $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' ); @@ -284,6 +289,7 @@ case 'UP_TARGET_VERSION': print_version_option_list( '', $t_project_id, VERSION_FUTURE, true, true ); break; + case 'UP_PRODUCT_VERSION': case 'UP_FIXED_IN_VERSION': print_version_option_list( '', $t_project_id, VERSION_ALL, true, true ); break; diff --git a/core/bug_group_action_api.php b/core/bug_group_action_api.php index 7a8dc62af2..933489195b 100644 --- a/core/bug_group_action_api.php +++ b/core/bug_group_action_api.php @@ -284,6 +284,12 @@ function bug_group_action_get_commands( array $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 7323592bb9..3d6eb02067 100644 --- a/lang/strings_english.txt +++ b/lang/strings_english.txt @@ -89,6 +89,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'; @@ -198,6 +199,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'; @@ -211,6 +213,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';