View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0008323 | mantisbt | custom fields | public | 2007-08-29 15:41 | 2012-09-16 17:21 |
Reporter | ntbone | Assigned To | dregad | ||
Priority | normal | Severity | tweak | Reproducibility | always |
Status | closed | Resolution | duplicate | ||
Product Version | 1.1.0a4 | ||||
Summary | 0008323: Spaces in custom fields | ||||
Description | If you have a custom field with spaces included and you add it as a column to the "View Issues" page the column is not sortable. When you click on the column nothing happens. The reason for the problem is that the URL sent to sort by that column includes the space thus producing the wrong information. If one adds "urlencode" around the sorting field, the column becomes sortable again. This problem may also occur if you use the # sign. For example, we added a custom field called "Marketing #" but was unable to sort by it. I fixed the problem | ||||
Steps To Reproduce |
| ||||
Additional Information | The fix occurs in print_view_bug_sort_link. The problem is that the url created to sort the lists does not encode spaces or special characters. | ||||
Tags | No tags attached. | ||||
Attached Files | custom funciton code and fix.txt (3,919 bytes)
# -------------------- # returns an array of the column names to be displayed. # The column names to use are those of the field names in the bug table. # In addition, you can use the following: # - "selection" for selection checkboxes. # - "edit" for icon to open the edit page. # - "custom_xxxx" were xxxx is the name of the custom field that is valid for the # current project. In case of "All Projects, the field will be empty where it is # not applicable. # $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php function custom_function_override_get_columns_to_view( $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { $t_columns = array(); if ( $p_columns_target == COLUMNS_TARGET_CSV_PAGE ) { $t_columns[] = 'id'; // localized: 'id', $t_columns[] = 'project_id'; // 'email_project' $t_columns[] = 'reporter_id'; // 'reporter' $t_columns[] = 'handler_id'; // 'assigned_to' $t_columns[] = 'priority'; // 'priority' $t_columns[] = 'severity'; // 'severity' $t_columns[] = 'reproducibility'; // 'reproducibility' $t_columns[] = 'version'; // 'version' $t_columns[] = 'projection'; // 'projection' $t_columns[] = 'category'; // 'category' $t_columns[] = 'date_submitted'; // 'date_submitted' $t_columns[] = 'eta'; // 'eta' $t_columns[] = 'os'; // 'os' $t_columns[] = 'os_build'; // 'os_version' $t_columns[] = 'platform'; // 'platform' $t_columns[] = 'view_state'; // 'view_status' $t_columns[] = 'last_updated'; // 'last_update' $t_columns[] = 'summary'; // 'summary' $t_columns[] = 'status'; // 'status' $t_columns[] = 'resolution'; // 'resolution' $t_columns[] = 'fixed_in_version'; // 'fixed_in_version'; if ( OFF == config_get( 'enable_relationship' ) ) { $t_columns[] = 'duplicate_id'; // 'duplicate_id' } } else { $t_columns[] = 'selection'; if ( $p_columns_target == COLUMNS_TARGET_VIEW_PAGE ) { $t_columns[] = 'edit'; } # $t_columns[] = 'priority'; $t_columns[] = 'id'; $t_columns[] = 'Risk #'; $t_columns[] = 'custom_Special Priority'; $t_columns[] = 'custom_Marketing #'; $t_enable_sponsorship = config_get( 'enable_sponsorship' ); if ( ON == $t_enable_sponsorship ) { $t_columns[] = 'sponsorship_total'; } $t_columns[] = 'bugnotes_count'; $t_show_attachments = config_get( 'show_attachment_indicator' ); if ( ON == $t_show_attachments ) { $t_columns[] = 'attachment'; } $t_columns[] = 'category'; # $t_columns[] = 'severity'; $t_columns[] = 'status'; $t_columns[] = 'last_updated'; $t_columns[] = 'summary'; } return $t_columns; } #modified print_view_bug_sort_link to fix the problem. function print_view_bug_sort_link( $p_string, $p_sort_field, $p_sort, $p_dir, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { if ( $p_columns_target == COLUMNS_TARGET_PRINT_PAGE ) { if ( $p_sort_field == $p_sort ) { # We toggle between ASC and DESC if the user clicks the same sort order if ( 'ASC' == $p_dir ) { $p_dir = 'DESC'; } else { $p_dir = 'ASC'; } } else { # Otherwise always start with ASCending $t_dir = 'ASC'; } echo '<a href="view_all_set.php?sort='.urlencode($p_sort_field).'&dir='.$p_dir.'&type=2&print=1">'.$p_string.'</a>'; } else if ( $p_columns_target == COLUMNS_TARGET_VIEW_PAGE ) { if ( $p_sort_field == $p_sort ) { # we toggle between ASC and DESC if the user clicks the same sort order if ( 'ASC' == $p_dir ) { $p_dir = 'DESC'; } else { $p_dir = 'ASC'; } } else { # Otherwise always start with ASCending $t_dir = 'ASC'; } echo '<a href="view_all_set.php?sort='.urlencode($p_sort_field).'&dir='.$p_dir.'&type=2">'.$p_string.'</a>'; } else { echo $p_string; } } | ||||
duplicate of | 0012680 | closed | dregad | Custom field name with paranthesis leads to db error message when sorting "view issues" |
duplicate of | 0012404 | closed | dregad | custom field sort issue on view issues page |
related to | 0003767 | closed | grangeway | Enumeration Custum fields with html-special chars get unselected on bug-update |
related to | 0005859 | closed | daryn | "Sort by" can't handle more than one custom field in combination |
Could you please resubmit your fix as a patch? more info for creating a proper patch here: http://www.mantisbt.org/wiki/doku.php/mantisbt:howto_submit_patches |
|
I will do so as soon as possible. |
|
We get these SQL-errors when sorting for custom fields containing "special" characters:
|
|
Hauptmann also posted the same fix for 0005859 |
|
See the patches attached to 0005859 as they appear to fix this problem for me. |
|