View Issue Details

IDProjectCategoryView StatusLast Update
0004307mantisbtbugtrackerpublic2013-10-24 04:46
Reporterjwolfgarten Assigned To 
PrioritynormalSeverityfeatureReproducibilityalways
Status acknowledgedResolutionopen 
Summary0004307: Highest version in "Fixed in version" preselected
Description

It would be very nice, if the field "Fixed in version" is predefined with the highest version available. So that, if I fix a bug, it is automatically part of the next version.

Tagspatch
Attached Files
06-mantis-1.0.0rc1-latest_unreleased_ver.patch (1,643 bytes)   
diff -Nru old/core/print_api.php new/core/print_api.php
--- old/core/print_api.php	2005-07-29 15:27:30.000000000 +0300
+++ new/core/print_api.php	2005-07-29 15:24:42.000000000 +0300
@@ -575,6 +575,7 @@
 		} else {
 			$versions = version_get_all_rows( $c_project_id, $p_released );
 		}
+		$p_version = ($p_version == '' ) ? version_get_last_unreleased_row( $c_project_id ) : $p_version;
 
 		if ( $p_leading_blank ) {
 			echo '<option value=""></option>';
diff -Nru old/core/version_api.php new/core/version_api.php
--- old/core/version_api.php	2005-07-29 15:27:43.000000000 +0300
+++ new/core/version_api.php	2005-07-29 15:22:45.000000000 +0300
@@ -271,6 +271,33 @@
 		return $rows;
 	}
 	
+	function version_get_last_unreleased_row( $p_project_id, $p_released = 0 ) {
+		$c_project_id = db_prepare_int( $p_project_id );
+
+		if ( $p_released === null ) {
+			$t_released_where = '';
+		} else {
+			$c_released = db_prepare_int( $p_released );
+			$t_released_where = "AND ( released = $c_released )";
+		}
+
+		$t_project_version_table = config_get( 'mantis_project_version_table' );
+
+		$query = "SELECT *
+				  FROM $t_project_version_table
+				  WHERE project_id='$c_project_id' $t_released_where
+				  ORDER BY date_order DESC
+				  LIMIT 1";
+		$result = db_query( $query );
+		$count = db_num_rows( $result );
+		$latest = '';
+		if( $count == 1) {
+			$row = db_fetch_array( $result );
+			$latest = $row['version'];
+		}
+		return $latest;
+	}
+
 	# --------------------
 	# Return all versions for the specified project, including subprojects
 	function version_get_all_rows_with_subs( $p_project_id, $p_released = null ) {
20071011_0004307.patch (1,123 bytes)   
Index: bug_change_status_page.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/bug_change_status_page.php,v
retrieving revision 1.28
diff -u -r1.28 bug_change_status_page.php
--- bug_change_status_page.php	13 Jul 2007 07:58:26 -0000	1.28
+++ bug_change_status_page.php	11 Oct 2007 12:37:03 -0000
@@ -215,6 +215,9 @@
 		|| ( ( AUTO == config_get( 'show_product_version' ) )
 					&& ( count( version_get_all_rows( $t_bug->project_id ) ) > 0 ) );
 	if ( $t_show_version ) {
+		$t_default_fixed_in_version = bug_get_field( $f_bug_id, 'fixed_in_version' );
+		if ( $t_default_fixed_in_version == '' )
+			$t_default_fixed_in_version = bug_get_field( $f_bug_id, 'target_version' );
 ?>
 <!-- Fixed in Version -->
 <tr <?php echo helper_alternate_class() ?>>
@@ -223,7 +226,7 @@
 	</td>
 	<td>
 		<select name="fixed_in_version">
-			<?php print_version_option_list( bug_get_field( $f_bug_id, 'fixed_in_version' ),
+			<?php print_version_option_list( $t_default_fixed_in_version,
 							bug_get_field( $f_bug_id, 'project_id' ), VERSION_ALL ) ?>
 		</select>
 	</td>
20071011_0004307.patch (1,123 bytes)   

Relationships

child of 0004181 closed Features in Mantis 1.1 release 

Activities

jlatour

jlatour

2004-08-11 03:33

reporter   ~0006924

There should still be an option to select 'no version'.

Perhaps we could also make the default the next unreleased version, or one that has been set to be default?

xbromy

xbromy

2004-10-01 08:06

reporter   ~0007858

in our workflow there is always a version called "next release" which is not released. this version will be renamed if whe release a version and then we ad a new version "next release" :-) so it will be nice to sav in config 1. preselect highest number or preselect by name "yyxx" or preselect by not released

jonozzz

jonozzz

2005-07-29 08:39

reporter   ~0011013

I've made a quick patch right now.
It auto preselects latest unreleased version for the current project. It should work as it works for me ;)

And BTW it's for Mantis-1.0.0rc1

gianluca

gianluca

2006-04-27 05:23

reporter   ~0012733

I would prefer having that tunable ( config ? ): I usually fix bugs to a special version named CVS_HEAD and then, when the release is done, switch the field to the proper release number.
This is much like note 7858 above

ave

ave

2007-10-11 08:48

reporter   ~0015850

I have attached a patch (20071011_4307.patch) which pre-selects the target version of a issue when resolving it.
Hope this benefits someone.

jlopezs@asenit.com

jlopezs@asenit.com

2013-10-24 04:46

reporter   ~0038340

I've reprogrammed this bug fix for MANTIS 1.3.0devmaster-dcc0fbe.

FILE: mantis/core/print_api.php


    # Ensure the selected version (if specified) is included in the list
    # Note: Filter API specifies selected versions as an array
    if( !is_array( $p_version ) ) {
            if( !empty( $p_version ) ) {
                    $t_version_id = version_get_id( $p_version, $c_project_id );
                    if( $t_version_id !== false ) {
                            $versions[] = version_cache_row( $t_version_id );
                    }
            }
    }
  • // Highest version in "Fixed in version" preselected
  • // Author Bugfix: ASENIT TECHNOLGIES S.L.
  • $p_version = ($p_version == '' ) ? version_get_last_unreleased_row( $c_project_id ) : $p_version;

    if( $p_leading_blank ) {
            echo '<option value=""></option>';
    }

FILE: mantis/core/version_api.php


    }
    return $rows;

}

  • /**
    • Highest version in "Fixed in version" preselected
    • Author Bugfix: ASENIT TECHNOLGIES S.L.
  • */
  • function version_get_last_unreleased_row($p_project_id, $p_released = 0)
  • {
  • if ($p_released === null)
  • {
  • $t_released_where = '';
  • }
  • else
  • {
  • $c_released = db_prepare_int($p_released);
  • $t_released_where = "AND ( released = $c_released )";
  • }
  • $c_project_id = db_prepare_int($p_project_id);
  • $t_project_version_table = db_get_table('project_version');
  • $query = "SELECT *
  • FROM $t_project_version_table
  • WHERE project_id='$c_project_id' $t_released_where
  • ORDER BY date_order DESC
  • LIMIT 1";
  • $query_params = array();
  • $result = db_query_bound($query, $query_params);
  • $count = db_num_rows($result);
  • $latest = '';
  • if ($count == 1)
  • {
  • $row = db_fetch_array($result);
  • $latest = $row['version'];
  • }
  • return $latest;
  • }

/**

  • Return all versions for the specified project, including subprojects
  • @param int $p_project_id
  • @param int $p_released
  • @param bool $p_obsolete
  • @return array
    */
    function version_get_all_rows_with_subs( $p_project_id, $p_released = null, $p_obsolete = false ) {
    $t_project_where = helper_project_specific_where( $p_project_id );

Hope this help!