View Issue Details

IDProjectCategoryView StatusLast Update
0008269mantisbtroadmappublic2007-10-04 01:38
Reporterruslan Assigned Tojreese  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product Version1.1.0a4 
Fixed in Version1.1.0rc1 
Summary0008269: Reporting a new issue, ADMIN/MANAGER/DEVELOPER should see field "Target Version"
Description

Really, because no I seat before Mantis.
start enter 15 new issues - tasks for our developers.
YES I want use Mantis as Project Managment tool :-)

and currently I need after report of issue, click UPDATE and set menu with Target Version.
ANNOYING !!!!!

TagsNo tags attached.
Attached Files
mantis-target-2007-08-20.patch (3,935 bytes)   
diff -urN --exclude=CVS --exclude=.svn --exclude=.swp --exclude='.git*' --exclude=config_inc.php mantis-cvs/bug_report_advanced_page.php mantis-target/bug_report_advanced_page.php
--- mantis-cvs/bug_report_advanced_page.php	2007-08-07 10:47:14.000000000 -0400
+++ mantis-target/bug_report_advanced_page.php	2007-08-20 15:30:32.000000000 -0400
@@ -66,6 +66,7 @@
 		$f_os					= $t_bug->os;
 		$f_os_build				= $t_bug->os_build;
 		$f_product_version		= $t_bug->version;
+		$f_target_version		= $t_bug->target_version;
 		$f_profile_id			= 0;
 		$f_handler_id			= $t_bug->handler_id;
 
@@ -88,6 +89,7 @@
 		$f_os					= gpc_get_string( 'os', '' );
 		$f_os_build				= gpc_get_string( 'os_build', '' );
 		$f_product_version		= gpc_get_string( 'product_version', '' );
+		$f_target_version		= gpc_get_string( 'target_version', '' );
 		$f_profile_id			= gpc_get_int( 'profile_id', 0 );
 		$f_handler_id			= gpc_get_int( 'handler_id', 0 );
 
@@ -356,6 +358,20 @@
 </tr>
 <?php } ?>
 
+<!-- Target Version (if permissions allow) -->
+<?php if ( access_has_project_level( config_get( 'handle_bug_threshold' ) ) ) { ?>
+<tr <?php echo helper_alternate_class() ?>>
+	<td class="category">
+		<?php echo lang_get( 'target_version' ) ?>
+	</td>
+	<td>
+		<select <?php echo helper_get_tab_index() ?> name="target_version">
+			<?php print_version_option_list() ?>
+		</select>
+	</td>
+</tr>
+<?php } ?>
+
 
 <!-- spacer -->
 <tr class="spacer">
diff -urN --exclude=CVS --exclude=.svn --exclude=.swp --exclude='.git*' --exclude=config_inc.php mantis-cvs/bug_report.php mantis-target/bug_report.php
--- mantis-cvs/bug_report.php	2007-08-07 10:47:14.000000000 -0400
+++ mantis-target/bug_report.php	2007-08-20 15:30:27.000000000 -0400
@@ -28,6 +28,7 @@
 	$t_bug_data->os					= gpc_get_string( 'os', '' );
 	$t_bug_data->os_build				= gpc_get_string( 'os_build', '' );
 	$t_bug_data->version			= gpc_get_string( 'product_version', '' );
+	$t_bug_data->target_version		= access_has_project_level( config_get( 'handle_bug_threshold' ) ) ? gpc_get_string( 'target_version', '' ) : '';
 	$t_bug_data->profile_id			= gpc_get_int( 'profile_id', 0 );
 	$t_bug_data->handler_id			= gpc_get_int( 'handler_id', 0 );
 	$t_bug_data->view_state			= gpc_get_int( 'view_state', config_get( 'default_bug_view_status' ) );
@@ -165,6 +166,7 @@
 		<input type="hidden" name="os" 			value="<?php echo $t_bug_data->os ?>" />
 		<input type="hidden" name="os_build" 		value="<?php echo $t_bug_data->os_build ?>" />
 		<input type="hidden" name="product_version" 	value="<?php echo $t_bug_data->version ?>" />
+		<input type="hidden" name="target_version" 	value="<?php echo $t_bug_data->target_version ?>" />
 		<input type="hidden" name="build" 		value="<?php echo $t_bug_data->build ?>" />
 		<input type="hidden" name="report_stay" 	value="1" />
 		<input type="hidden" name="view_state"		value="<?php echo $t_bug_data->view_state ?>" />
diff -urN --exclude=CVS --exclude=.svn --exclude=.swp --exclude='.git*' --exclude=config_inc.php mantis-cvs/core/bug_api.php mantis-target/core/bug_api.php
--- mantis-cvs/core/bug_api.php	2007-08-07 10:47:13.000000000 -0400
+++ mantis-target/core/bug_api.php	2007-08-20 15:20:27.000000000 -0400
@@ -345,6 +345,7 @@
 		$c_os_build				= db_prepare_string( $p_bug_data->os_build );
 		$c_platform				= db_prepare_string( $p_bug_data->platform );
 		$c_version				= db_prepare_string( $p_bug_data->version );
+		$c_target_version		= db_prepare_string( $p_bug_data->target_version );
 		$c_build				= db_prepare_string( $p_bug_data->build );
 		$c_profile_id			= db_prepare_int( $p_bug_data->profile_id );
 		$c_view_state			= db_prepare_int( $p_bug_data->view_state );
@@ -441,7 +442,7 @@
 				      '$c_platform', '$c_version',
 				      '$c_build',
 				      '$c_profile_id', '$c_summary', '$c_view_state', '$c_sponsorship_total', '$c_sticky', '',
-				      ''
+				      '$c_target_version'
 				    )";
 		db_query( $query );
 
mantis-target-2007-08-20.patch (3,935 bytes)   
mantis-target-2007-08-23.patch (6,856 bytes)   
diff -urN --exclude=CVS --exclude=.svn --exclude=.swp --exclude='.git*' --exclude=config_inc.php mantis-cvs/bug_report_advanced_page.php mantis-target/bug_report_advanced_page.php
--- mantis-cvs/bug_report_advanced_page.php	2007-08-07 10:47:14.000000000 -0400
+++ mantis-target/bug_report_advanced_page.php	2007-08-21 08:39:50.000000000 -0400
@@ -66,6 +66,7 @@
 		$f_os					= $t_bug->os;
 		$f_os_build				= $t_bug->os_build;
 		$f_product_version		= $t_bug->version;
+		$f_target_version		= $t_bug->target_version;
 		$f_profile_id			= 0;
 		$f_handler_id			= $t_bug->handler_id;
 
@@ -88,6 +89,7 @@
 		$f_os					= gpc_get_string( 'os', '' );
 		$f_os_build				= gpc_get_string( 'os_build', '' );
 		$f_product_version		= gpc_get_string( 'product_version', '' );
+		$f_target_version		= gpc_get_string( 'target_version', '' );
 		$f_profile_id			= gpc_get_int( 'profile_id', 0 );
 		$f_handler_id			= gpc_get_int( 'handler_id', 0 );
 
@@ -356,6 +358,20 @@
 </tr>
 <?php } ?>
 
+<!-- Target Version (if permissions allow) -->
+<?php if ( access_has_project_level( config_get( 'roadmap_update_threshold' ) ) ) { ?>
+<tr <?php echo helper_alternate_class() ?>>
+	<td class="category">
+		<?php echo lang_get( 'target_version' ) ?>
+	</td>
+	<td>
+		<select <?php echo helper_get_tab_index() ?> name="target_version">
+			<?php print_version_option_list() ?>
+		</select>
+	</td>
+</tr>
+<?php } ?>
+
 
 <!-- spacer -->
 <tr class="spacer">
diff -urN --exclude=CVS --exclude=.svn --exclude=.swp --exclude='.git*' --exclude=config_inc.php mantis-cvs/bug_report.php mantis-target/bug_report.php
--- mantis-cvs/bug_report.php	2007-08-07 10:47:14.000000000 -0400
+++ mantis-target/bug_report.php	2007-08-21 08:40:50.000000000 -0400
@@ -28,6 +28,7 @@
 	$t_bug_data->os					= gpc_get_string( 'os', '' );
 	$t_bug_data->os_build				= gpc_get_string( 'os_build', '' );
 	$t_bug_data->version			= gpc_get_string( 'product_version', '' );
+	$t_bug_data->target_version		= access_has_project_level( config_get( 'roadmap_update_threshold' ) ) ? gpc_get_string( 'target_version', '' ) : '';
 	$t_bug_data->profile_id			= gpc_get_int( 'profile_id', 0 );
 	$t_bug_data->handler_id			= gpc_get_int( 'handler_id', 0 );
 	$t_bug_data->view_state			= gpc_get_int( 'view_state', config_get( 'default_bug_view_status' ) );
@@ -165,6 +166,7 @@
 		<input type="hidden" name="os" 			value="<?php echo $t_bug_data->os ?>" />
 		<input type="hidden" name="os_build" 		value="<?php echo $t_bug_data->os_build ?>" />
 		<input type="hidden" name="product_version" 	value="<?php echo $t_bug_data->version ?>" />
+		<input type="hidden" name="target_version" 	value="<?php echo $t_bug_data->target_version ?>" />
 		<input type="hidden" name="build" 		value="<?php echo $t_bug_data->build ?>" />
 		<input type="hidden" name="report_stay" 	value="1" />
 		<input type="hidden" name="view_state"		value="<?php echo $t_bug_data->view_state ?>" />
diff -urN --exclude=CVS --exclude=.svn --exclude=.swp --exclude='.git*' --exclude=config_inc.php mantis-cvs/bug_update_advanced_page.php mantis-target/bug_update_advanced_page.php
--- mantis-cvs/bug_update_advanced_page.php	2007-08-07 10:47:14.000000000 -0400
+++ mantis-target/bug_update_advanced_page.php	2007-08-21 08:38:50.000000000 -0400
@@ -417,7 +417,7 @@
 <tr <?php echo helper_alternate_class() ?>>
 
 <?php
-	if ( access_has_bug_level( config_get( 'roadmap_view_threshold' ), $f_bug_id ) ) {
+	if ( access_has_bug_level( config_get( 'roadmap_update_threshold' ), $f_bug_id ) ) {
 ?>
 	<!-- spacer -->
 	<td colspan="2">&nbsp;</td>
diff -urN --exclude=CVS --exclude=.svn --exclude=.swp --exclude='.git*' --exclude=config_inc.php mantis-cvs/config_defaults_inc.php mantis-target/config_defaults_inc.php
--- mantis-cvs/config_defaults_inc.php	2007-08-16 13:23:56.000000000 -0400
+++ mantis-target/config_defaults_inc.php	2007-08-21 08:43:13.000000000 -0400
@@ -1113,6 +1113,9 @@
 	# threshold for viewing roadmap
 	$g_roadmap_view_threshold = VIEWER;
 	
+	# threshold for updating roadmap, target_version, etc
+	$g_roadmap_update_threshold = DEVELOPER;
+	
 	# status change thresholds
 	$g_update_bug_status_threshold = DEVELOPER;
 
diff -urN --exclude=CVS --exclude=.svn --exclude=.swp --exclude='.git*' --exclude=config_inc.php mantis-cvs/core/bug_api.php mantis-target/core/bug_api.php
--- mantis-cvs/core/bug_api.php	2007-08-07 10:47:13.000000000 -0400
+++ mantis-target/core/bug_api.php	2007-08-21 08:37:33.000000000 -0400
@@ -370,6 +370,13 @@
 			trigger_error( ERROR_EMPTY_FIELD, ERROR );
 		}
 
+		# Only set target_version if user has access to do so
+		if ( access_has_project_level( config_get( 'roadmap_update_threshold' ) ) ) {
+			$c_target_version	= db_prepare_string( $p_bug_data->target_version );
+		} else { 
+			$c_target_version	= '';
+		}
+
 		$t_bug_table				= config_get( 'mantis_bug_table' );
 		$t_bug_text_table			= config_get( 'mantis_bug_text_table' );
 		$t_project_category_table	= config_get( 'mantis_project_category_table' );
@@ -441,7 +448,7 @@
 				      '$c_platform', '$c_version',
 				      '$c_build',
 				      '$c_profile_id', '$c_summary', '$c_view_state', '$c_sponsorship_total', '$c_sticky', '',
-				      ''
+				      '$c_target_version'
 				    )";
 		db_query( $query );
 
@@ -802,8 +809,16 @@
 					platform='$c_bug_data->platform',
 					version='$c_bug_data->version',
 					build='$c_bug_data->build',
-					fixed_in_version='$c_bug_data->fixed_in_version',
-					target_version='$c_bug_data->target_version',
+					fixed_in_version='$c_bug_data->fixed_in_version',";
+
+		$t_roadmap_updated = false;
+		if ( access_has_project_level( config_get( 'roadmap_update_threshold' ) ) ) {
+			$query .= "
+					target_version='$c_bug_data->target_version',";
+			$t_roadmap_updated = true;
+		}
+
+		$query .= "
 					view_state='$c_bug_data->view_state',
 					summary='$c_bug_data->summary',
 					sponsorship_total='$c_bug_data->sponsorship_total',
@@ -832,7 +847,9 @@
 		history_log_event_direct( $p_bug_id, 'version', $t_old_data->version, $p_bug_data->version );
 		history_log_event_direct( $p_bug_id, 'build', $t_old_data->build, $p_bug_data->build );
 		history_log_event_direct( $p_bug_id, 'fixed_in_version', $t_old_data->fixed_in_version, $p_bug_data->fixed_in_version );
-		history_log_event_direct( $p_bug_id, 'target_version', $t_old_data->target_version, $p_bug_data->target_version );
+		if ( $t_roadmap_updated ) {
+			history_log_event_direct( $p_bug_id, 'target_version', $t_old_data->target_version, $p_bug_data->target_version );
+		}
 		history_log_event_direct( $p_bug_id, 'view_state', $t_old_data->view_state, $p_bug_data->view_state );
 		history_log_event_direct( $p_bug_id, 'summary', $t_old_data->summary, $p_bug_data->summary );
 		history_log_event_direct( $p_bug_id, 'sponsorship_total', $t_old_data->sponsorship_total, $p_bug_data->sponsorship_total );
mantis-target-2007-08-23.patch (6,856 bytes)   

Relationships

child of 0008306 new Ruslan's Vision: PUSH MANTIS to Project Maagment. 

Activities

jreese

jreese

2007-08-17 17:49

reporter   ~0015446

I would love to see this as well, and I think this just might be the next thing I do. Maybe I can knock it out over the weekend, since my PS3 toasted in the summer heat and humidity (piss-poor AC is almost worse than no AC).

jreese

jreese

2007-08-20 15:36

reporter   ~0015462

Last edited: 2007-08-20 15:40

Patch 'mantis-target-2007-08-20.patch' was created from CVS head on Monday, Aug 20, 2007.

Allows users with handle_bug_threshold (default DEVELOPER) access or higher to set Target Version for a bug during the advanced report bug process:

  • Adds Target Version dropdown box to bug_report_advanced_page.php
  • Adds Target Version handling to bug_report.php
  • Adds code to Bug API bug_create() to handle Target Version.
vboctor

vboctor

2007-08-21 02:06

manager   ~0015464

The patch looks good. I just have one comment.

  • The checking for whether the current user has access to set the target version should be done in two places:
    1. On the report page.
    2. In the bug_create() API.

The reason for doing the second check in the API rather than the bug_report.php is to handle the case where a bug is reported via MantisConnect rather than via the web interface.

vboctor

vboctor

2007-08-21 02:11

manager   ~0015465

I had a look at the update code. The current user is allowed to update the roadmap if they have roadmap_view_threshold.

I am thinking we should do the following:

  1. Add roadmap_update_threshold configuration option.
  2. Use it in both report / update code paths.
  3. Update bug_api.php bug_create() (set to '' if user doesn't have access) and bug_update() (leave target_version as is if user doesn't have the required access).
jreese

jreese

2007-08-21 07:28

reporter   ~0015468

Sounds good and makes sense, I'll make those modifications today and create a new patch.

jreese

jreese

2007-08-21 08:50

reporter   ~0015470

Patch 'mantis-target-2007-08-21.patch' was created from CVS head on Monday, Aug 21, 2007.

Allows users with roadmap_update_threshold (default DEVELOPER) access or higher to set Target Version while both reporting and updating bugs with the advanced pages. Without access, the fields will not be shown.

  • Adds roadmap_update_threshold to config_defaults_inc.php
  • Adds Target Version dropdown box to bug_report_advanced_page.php
  • Adds Target Version handling to bug_report.php
  • Modifies bug_update_advanced_page.php to change permission required for Target Version
  • Adds code to Bug API bug_create() to handle Target Version.
  • Adds code to Bug API bug_update() to check for proper permissions.
stefang

stefang

2007-08-23 10:49

reporter   ~0015495

I've tried to adopt your patch to the MANTIS 1.1.0a4 release, because I would love this feature too.
Unfortunately the used function access_user_has_project_level() does not exist in the 1.1.0a4 release yet.
Can you point me to the file I need to update from CVS to add this function to my installation as well?
Thanks,
Stefan

jreese

jreese

2007-08-23 11:05

reporter   ~0015496

That was my mistake, a result of quick patching without full testing. That function call should be to access_has_project_level() instead. I've fixed the and re-uploaded the patch (now named for the 23rd instead). Thank you for catching this.

vboctor

vboctor

2007-08-23 12:10

manager   ~0015497

jreese, are you using the following configuration in your dev instance?

$g_show_detailed_errors = ON;
$g_display_errors = array(
    E_WARNING => 'halt',
    E_NOTICE => 'halt',
    E_USER_ERROR => 'halt',
    E_USER_WARNING => 'halt',
    E_USER_NOTICE => 'halt'
);

This is to make sure that PHP won't just suppress any errors or notices. My assumption is that is why this syntax error was missed, right? Or maybe stegang tested a different scenario.

jreese

jreese

2007-08-23 13:38

reporter   ~0015500

I'm assuming it was more because I have multiple parallel instances of Mantis running, each with different sets of code on top of the CVS head (thanks to Git). I most likely made the change and inadvertantly tested in the wrong instance of Mantis, since that part of the changes were minor.

But anyways, no, I didn't have those set at the time, but they are already in my test sites now. In the future, I will also be more careful to test in the proper site. I'm still getting into the swing of non-linear development for Mantis, compared to the debug-fix-commit cycles from the previous project (which is what Mantis will be replacing).

stefang

stefang

2007-08-24 03:01

reporter   ~0015503

Works like a charm now on top of release 1.1.0a4.
Thanks,
Stefan

vboctor

vboctor

2007-08-24 03:45

manager   ~0015510

In bug_report.php, you check the access level against the current project. You should check against the project_id that is retrieved via gpc_get_int(). These may be different if a user does the following:

  1. Open Mantis in multiple tabs/windows.
  2. Click report in tab 1.
  3. Change project in tab 2.
  4. Go back to tab 1 and submit the new issue.

You can override the current project using $g_project_override. See the bug_view_page.php for an example.

When you are checking the access level in APIs, you should explicitly pass in the project id, i.e. don't check against current project.

Other than that, I guess you are ready to go with this feature. Lets get it committed.

vboctor

vboctor

2007-08-24 03:47

manager   ~0015511

You will also need to update bug_actiongroup.php to check the appropriate access level when updating target version for multiple issues.

jreese

jreese

2007-08-24 10:47

reporter   ~0015518

Committed changes to CVS with modifications specified by Victor.