Skip to content

Commit

Permalink
Define custom field alias using id instead of name
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dregad committed Dec 7, 2011
1 parent 246d411 commit 170e939
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/filter_api.php
Expand Up @@ -941,7 +941,7 @@ function filter_get_query_sort_data( &$p_filter, $p_show_sticky, $p_query_clause
$t_custom_field_id = custom_field_get_id_from_name( $t_custom_field );
$t_def = custom_field_get_definition( $t_custom_field_id );
$t_value_field = ( $t_def['type'] == CUSTOM_FIELD_TYPE_TEXTAREA ? 'text' : 'value' );
$c_cf_alias = str_replace( ' ', '_', $t_custom_field );
$c_cf_alias = 'custom_field_' . $t_custom_field_id;
$t_cf_table_alias = $t_custom_field_string_table . '_' . $t_custom_field_id;
$t_cf_select = "$t_cf_table_alias.$t_value_field $c_cf_alias";

Expand Down

0 comments on commit 170e939

Please sign in to comment.