Browse files

Fix #15481: custom field values sort order in view all page filter

Commit b5abce1 introduced a regression
in the sort order of custom field values because the query retrieving
the custom field values was rewritten with a SELECT DISTINCT instead of
using a GROUP BY clause. With MySQL, group by sorts the results, whereas
distinct does not (not tested with other RDBMS).

This fixes the issue by adding an ORDER BY clause.
  • Loading branch information...
1 parent 15db187 commit b8dc99376f4b0dde8e8c210086df5809061d01ed @dregad dregad committed Feb 9, 2013
Showing with 2 additions and 1 deletion.
  1. +2 −1 core/custom_field_api.php
@@ -1150,7 +1150,8 @@ function custom_field_distinct_values( $p_field_def, $p_project_id = ALL_PROJECT
$t_query = "
FROM $t_from
- WHERE $t_where1 $t_where2";
+ WHERE $t_where1 $t_where2
+ ORDER BY cfst.value";
$t_result = db_query_bound( $t_query, $t_params );
$t_row_count = db_num_rows( $t_result );

0 comments on commit b8dc993

Please sign in to comment.