Skip to content

Commit 170e939

Browse files
committedDec 7, 2011
Define custom field alias using id instead of name
The old method of defining a custom field alias based on the field's name, generated SQL syntax error when trying to sort on that field in the view issues page, if the name contains characters not valid for an SQL identifier (e.g. '-', '(', ')', etc). Fixes #12404, #12680
1 parent 246d411 commit 170e939

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
 

‎core/filter_api.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -941,7 +941,7 @@ function filter_get_query_sort_data( &$p_filter, $p_show_sticky, $p_query_clause
941941
$t_custom_field_id = custom_field_get_id_from_name( $t_custom_field );
942942
$t_def = custom_field_get_definition( $t_custom_field_id );
943943
$t_value_field = ( $t_def['type'] == CUSTOM_FIELD_TYPE_TEXTAREA ? 'text' : 'value' );
944-
$c_cf_alias = str_replace( ' ', '_', $t_custom_field );
944+
$c_cf_alias = 'custom_field_' . $t_custom_field_id;
945945
$t_cf_table_alias = $t_custom_field_string_table . '_' . $t_custom_field_id;
946946
$t_cf_select = "$t_cf_table_alias.$t_value_field $c_cf_alias";
947947

0 commit comments

Comments
 (0)
Please sign in to comment.