Skip to content

Commit

Permalink
Fix #15481: custom field values sort order in view all page filter
Browse files Browse the repository at this point in the history
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
dregad committed Feb 9, 2013
1 parent 15db187 commit b8dc993
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion core/custom_field_api.php
Expand Up @@ -1150,7 +1150,8 @@ function custom_field_distinct_values( $p_field_def, $p_project_id = ALL_PROJECT
$t_query = "
SELECT DISTINCT cfst.value
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 );
Expand Down

0 comments on commit b8dc993

Please sign in to comment.