Skip to content

Commit

Permalink
Allow mass update of 'Product Version' field
Browse files Browse the repository at this point in the history
Fixes #11802, pull request #331
  • Loading branch information
dregad committed Sep 24, 2014
2 parents 150986c + b5bb3a3 commit 989da6c
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 10 deletions.
30 changes: 20 additions & 10 deletions bug_actiongroup.php
Expand Up @@ -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 ) ) {
Expand All @@ -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' );
Expand Down Expand Up @@ -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 );
Expand Down Expand Up @@ -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' );
Expand All @@ -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' );
Expand Down
6 changes: 6 additions & 0 deletions bug_actiongroup_page.php
Expand Up @@ -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' );
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions core/bug_group_action_api.php
Expand Up @@ -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 ) ) {
Expand Down
3 changes: 3 additions & 0 deletions lang/strings_english.txt
Expand Up @@ -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';
Expand Down Expand Up @@ -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';
Expand All @@ -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';
Expand Down

0 comments on commit 989da6c

Please sign in to comment.