Skip to content

Commit b8dc993

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 15db187 commit b8dc993

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
@@ -1150,7 +1150,8 @@ function custom_field_distinct_values( $p_field_def, $p_project_id = ALL_PROJECT
11501150
$t_query = "
11511151
SELECT DISTINCT cfst.value
11521152
FROM $t_from
1153-
WHERE $t_where1 $t_where2";
1153+
WHERE $t_where1 $t_where2
1154+
ORDER BY cfst.value";
11541155

11551156
$t_result = db_query_bound( $t_query, $t_params );
11561157
$t_row_count = db_num_rows( $t_result );

0 commit comments

Comments
 (0)