Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
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...
commit b8dc99376f4b0dde8e8c210086df5809061d01ed 1 parent 15db187
@dregad dregad authored
Showing with 2 additions and 1 deletion.
  1. +2 −1  core/custom_field_api.php
View
3  core/custom_field_api.php
@@ -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 );
Please sign in to comment.
Something went wrong with that request. Please try again.