View Issue Details

IDProjectCategoryView StatusLast Update
0011802mantisbtbugtrackerpublic2014-12-08 00:33
Reportermattmccutchen Assigned Todregad  
PrioritynormalSeverityfeatureReproducibilityN/A
Status closedResolutionfixed 
Product Version1.2.0 
Target Version1.3.0-beta.1Fixed in Version1.3.0-beta.1 
Summary0011802: Update Product Version of multiple bugs
Description

The "View Issues" page should have an option to update the "Product Version" field of multiple bugs, just like the "Target Version" and "Fixed in Version" fields.

This would be a matter of copy and paste in a few places:

  • function print_all_bug_action_option_list in core/print_api.php
  • bug_actiongroup_page.php
  • bug_actiongroup.php
Tagspatch
Attached Files
bug-actiongroup-product-version.patch (4,860 bytes)   
Add support for changing "Product Version" of multiple bugs at once.

Includes string changes for English only.

diff --git a/bug_actiongroup.php b/bug_actiongroup.php
index 7c0ab32..4b5661a 100644
--- a/bug_actiongroup.php
+++ b/bug_actiongroup.php
@@ -244,6 +244,23 @@ foreach( $f_bug_arr as $t_bug_id ) {
 		}
 		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 fe5305e..2554140 100644
--- a/bug_actiongroup_page.php
+++ b/bug_actiongroup_page.php
@@ -198,6 +198,12 @@ switch ( $f_action )  {
 		$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' );
@@ -289,6 +295,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 fa113b9..5293e00 100644
--- a/core/bug_group_action_api.php
+++ b/core/bug_group_action_api.php
@@ -273,6 +273,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 60e5055..febcd55 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';
@@ -154,6 +155,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';
@@ -167,6 +169,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';
0001-Allow-mass-update-of-Product-Version-field.patch (5,388 bytes)   
From dc28294ddb72ad284b38dbd8621bf8e8f657424b Mon Sep 17 00:00:00 2001
From: Matt McCutchen <matt@mattmccutchen.net>
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 <dregad@mantisbt.org>
---
 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

0002-Added-missing-e-mail-notification.patch (1,062 bytes)   
From 8571875e364a6a323e2b340c6c20a81c574a7818 Mon Sep 17 00:00:00 2001
From: Damien Regad <dregad@mantisbt.org>
Date: Thu, 18 Sep 2014 14:13:53 +0200
Subject: [PATCH 2/2] Added missing e-mail notification

As per 568c5ea0feb25e3db8b9c018bdf745bf48dbc28b
---
 bug_actiongroup.php | 1 +
 1 file changed, 1 insertion(+)

diff --git a/bug_actiongroup.php b/bug_actiongroup.php
index bee1bbb..eecd66b 100644
--- a/bug_actiongroup.php
+++ b/bug_actiongroup.php
@@ -225,6 +225,7 @@
 				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 );
+					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' );
-- 
2.1.0

Activities

mattmccutchen

mattmccutchen

2010-04-16 04:45

reporter   ~0025137

The attached patch adds the ability to update the product version. It should be applied to the git trunk after the patches from 0011801. I did some basic tests and it seems to work.

micahg

micahg

2010-08-05 17:38

reporter   ~0026232

Setting status, version, target to that of bug 0010873

micahg

micahg

2010-08-05 17:52

reporter   ~0026233

sorry wrong bug...resetting

benjamind

benjamind

2014-09-17 09:26

reporter   ~0041235

The patch doesn't seem to have made its way into the last releases (1.2.17).

@mattmccutchen: Do you still use it? eventually did you find any bug in your patch?

dregad

dregad

2014-09-18 08:35

developer   ~0041243

Last edited: 2014-09-18 11:24

AFAICT original patch has just one issue, it does not send e-mail notifications (an issue which was fixed for other mass-update options in 1.2.16 (commit 568c5ea0).

https://github.com/mantisbt/mantisbt/pull/331

dregad

dregad

2014-09-24 07:02

developer   ~0041302

Attached the 1.2.x patches (mattmccutchen's original patch rebased on latest 1.2.x and the fix for notifications) for the record

Related Changesets

MantisBT: master 79489f70

2010-04-16 00:44

mattmccutchen

Committer: dregad


Details Diff
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 <dregad@mantisbt.org>

Matt's original commit was ported to master branch and modified to add a
missing e-mail notification (e28272287a33a80642b8a7cb50d4d2111aa3ef1a).

Fixes 0011802
Affected Issues
0011802
mod - bug_actiongroup.php Diff File
mod - bug_actiongroup_page.php Diff File
mod - core/bug_group_action_api.php Diff File
mod - lang/strings_english.txt Diff File

MantisBT: master 989da6c9

2014-09-24 02:48

dregad


Details Diff
Allow mass update of 'Product Version' field

Fixes 0011802, pull request 0000331
Affected Issues
0011802
mod - bug_actiongroup.php Diff File
mod - bug_actiongroup_page.php Diff File
mod - core/bug_group_action_api.php Diff File
mod - lang/strings_english.txt Diff File