View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0006872 | mantisbt | custom fields | public | 2006-03-20 05:38 | 2017-10-08 23:52 |
Reporter | stb | Assigned To | cproensa | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Product Version | 1.0.1 | ||||
Target Version | 2.7.0 | Fixed in Version | 2.7.0 | ||
Summary | 0006872: Sort of custom fields does not use data type | ||||
Description | I added a custom field to view_all_bug_page.php using custom_function_inc.php. The field is a "number" field (long integer) but is stored internally as string in mantis/mysql. If I click on the column header of this custom field the view gets sorted alphabetically (not numerically). Mantis should look at the specified data type and do numeric sort instead of pure text sort. I know mantis will support "real" numeric data types (storing real numbers in mysql database) in the future. But I think this should be fixed regardless of that feature. I personally see some advantages storing custom field values as string. | ||||
Tags | No tags attached. | ||||
related to | 0009120 | closed | atrol | Numeric Custom fields on View All don't sort correctly |
related to | 0023265 | closed | cproensa | Filter selection for numeric custom fields aren't sorted correctly on distinct values list |
child of | 0023443 | closed | cproensa | Fixes related to custom fields on filters, columns and visibility |
I've got the same exact problem, ¿could you solve it? I'd appreciate any help you can give me. Sebastián. |
|
Ok, here's a workaround which should work in most cases (at least in showing those bug lists). Only integer values will be sorted correctly and there's no warranty this will work. There might be errors if you have stored non-integers! Use at your own risk. Add the following lines into filter_api.php: (for my installation this is around line 837)
Those 4 lines should be added after the line: |
|
thanks a lot for your quick answer IT WORKED MORE THAN GREAT! |
|
I don't think this is very minor as indicated here. It's a bug that needs to get fixed sooner than later. On MantisHub I had to add a regular expression to suppress leading zeroes and users now have to enter leading zeroes to sort correctly. If a type is numeric and it does not sort according to the actual value, that's a major bug. |
|
The fixes are included in this pull request: https://github.com/mantisbt/mantisbt/pull/1183 Thanks |
|
MantisBT: master dc68e440 2017-08-25 16:03 Committer: dregad Details Diff |
Fix sorting for number based custom fields For types numeric, float, and dates - Make nulls appear last in the ordered result. - Cast the values to sort them numerically. Fixes: 0023260, 0006872 |
Affected Issues 0006872, 0023260 |
|
mod - core/filter_api.php | Diff File |