View Issue Details

IDProjectCategoryView StatusLast Update
0004750mantisbtbugtrackerpublic2015-08-01 14:55
Reporterchristianh Assigned To 
PrioritynormalSeverityfeatureReproducibilityN/A
Status newResolutionopen 
Product Version1.3.0-beta.1 
Summary0004750: Add option to sort product version alphabetically
Description

We use a number of subprojects (i.e. categories) with different versions. As they all need to be shared between the categories, we have many "types of version" for each project. It's much easier to find the version you are looking for alphabetically.

Additional Information

NB: This will also change the sort order on the Change Log page.

Attached Patch is against CVS HEAD.

Tagspatch
Attached Files
versionsort.patch (2,031 bytes)   
Index: config_defaults_inc.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/config_defaults_inc.php,v
retrieving revision 1.219
diff -u -r1.219 config_defaults_inc.php
--- config_defaults_inc.php	17 Oct 2004 00:14:27 -0000	1.219
+++ config_defaults_inc.php	21 Oct 2004 06:21:59 -0000
@@ -431,6 +431,11 @@
 	#  AUTO suppresses the display if there are no versions defined for the project
 	$g_show_product_version = AUTO;
 
+	# --- if product versions are shown sort them by date or alphabetically
+	#  ON sorts by version alphabetically
+	#  OFF (or no config) sorts by date most recent first
+	$g_product_version_sort_alpha = OFF;
+
 	# -- show users with their real name or not
 	$g_show_realname = OFF;
 	$g_differentiate_duplicates = OFF;  # leave off for now
Index: core/version_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/version_api.php,v
retrieving revision 1.18
diff -u -r1.18 version_api.php
--- core/version_api.php	21 Jul 2004 22:05:00 -0000	1.18
+++ core/version_api.php	21 Oct 2004 06:01:55 -0000
@@ -257,10 +257,24 @@
 
 		$t_project_version_table = config_get( 'mantis_project_version_table' );
 
+		# Sort order for product version.
+		# Either by date most recent first OR alphabetically ascending
+		if (ON == config_get( 'product_version_sort_alpha' )) {
+
+			# Sort by version alphabetically
+			$t_product_version_sort_alpha = "version ASC";
+		} else // --- if (OFF == config_get( 'product_version_sort_order' ) -->
+		{
+
+			# Descending date_order
+			$t_product_version_sort_alpha = "date_order DESC";
+		}
+
+
 		$query = "SELECT version, date_order
 				  FROM $t_project_version_table
 				  WHERE project_id='$c_project_id' $t_released_where
-				  ORDER BY date_order DESC";
+				  ORDER BY $t_product_version_sort_alpha";
 		$result = db_query( $query );
 		$count = db_num_rows( $result );
 		$rows = array();
versionsort.patch (2,031 bytes)   

Relationships

has duplicate 0005765 closedatrol Version sorting 
has duplicate 0005924 closedatrol Option to sort project versions by version number not by date 
has duplicate 0021810 closedatrol Sorting of values in drop down menues should be done by alphabet and not by registration into the database 
related to 0010419 acknowledged Allow customized sorting of versions 

Activities