View Issue Details

IDProjectCategoryView StatusLast Update
0009743mantisbtbugtrackerpublic2009-01-15 11:26
Reporterkarotos Assigned Tovboctor  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version1.2.0a2 
Fixed in Version1.2.0a3 
Summary0009743: sorting doesn't work in the View Issues page
Description

I tried to sort by any column name, either by setting it as a filter (advanced and simple) or by clicking on the column name.

The issues are always sorted by last modified

Steps To Reproduce
  1. login
  2. click "View Issues"
  3. <optional> reset the view filter
  4. Click on the Priority column name

Expected result:
The list of issues should be sorted by their Priority

Actual result:
They are sorted by last modification time (desc)

Additional Information

I also tried this here (http://www.mantisbt.org/bugs/view_all_bug_page.php) with the same results

This happens with any column, using any browser (firefox, IE) and with or without a proxy

Tagspatch
Attached Files
sort_by_priority_fail.gif (21,011 bytes)   
sort_by_priority_fail.gif (21,011 bytes)   
9743.patch (921 bytes)   
Index: core/filter_api.php
===================================================================
--- core/filter_api.php	(revision 5719)
+++ core/filter_api.php	(working copy)
@@ -832,6 +832,8 @@
 
 	for( $i = 0;$i < count( $t_sort_fields );$i++ ) {
 		$c_sort = db_prepare_string( $t_sort_fields[$i] );
+		$c_dir = 'DESC' == $t_dir_fields[$i] ? 'DESC' : 'ASC';
+
 		if( !in_array( $t_sort_fields[$i], array_slice( $t_sort_fields, $i + 1 ) ) ) {
 
 			# if sorting by a custom field
@@ -849,9 +851,11 @@
 					$p_query_clauses['join'][] = "LEFT JOIN $t_custom_field_string_table $t_cf_table_alias ON $t_bug_table.id  = $t_cf_table_alias.bug_id AND $t_cf_table_alias.field_id = $t_custom_field_id";
 				}
 
-				$c_dir = 'DESC' == $t_dir_fields[$i] ? 'DESC' : 'ASC';
 				$p_query_clauses['order'][] = "$c_cf_alias $c_dir";
 			}
+			else {
+				$p_query_clauses['order'][] = $c_sort . " " . $c_dir;
+			}
 		}
 	}
 
9743.patch (921 bytes)   

Relationships

has duplicate 0009730 closedvboctor Sorting does not work 
has duplicate 0009648 closedvboctor Sort not work 

Activities

gotdalife

gotdalife

2008-10-25 12:04

reporter   ~0019683

Attached a patch for this problem. Please review!

seiji

seiji

2008-10-25 13:26

reporter   ~0019686

duplicate of 0009648, 0009730

karotos

karotos

2008-10-27 05:16

reporter   ~0019691

tested the patch on my installation (trunk build 5719) and it works ok
thanks

Related Changesets

MantisBT: master f10a1782

2008-10-26 00:04

vboctor


Details Diff
Fixes 0009743: sorting doesn't work in the View Issues page

git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/trunk@5737 <a class="text" href="/?p=mantisbt.git;a=object;h=f5dc347c">f5dc347c</a>-c33d-0410-90a0-b07cc1902cb9
Affected Issues
0009743
mod - core/filter_api.php Diff File