Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 645ac2e

Browse files
committedFeb 9, 2013
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.
1 parent afa498b commit 645ac2e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed
 

‎core/custom_field_api.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -1161,7 +1161,8 @@ function custom_field_distinct_values( $p_field_def, $p_project_id = ALL_PROJECT
11611161
$t_query = "
11621162
SELECT DISTINCT cfst.value
11631163
FROM $t_from
1164-
WHERE $t_where1 $t_where2";
1164+
WHERE $t_where1 $t_where2
1165+
ORDER BY cfst.value";
11651166

11661167
$t_result = db_query_bound( $t_query, $t_params );
11671168
$t_row_count = db_num_rows( $t_result );

0 commit comments

Comments
 (0)
Please sign in to comment.