sorting custom fields for view_all_bug_ page
Moderators: Developer, Contributor
sorting custom fields for view_all_bug_ page
i'm trying to include a custom field of a date type into the view_all_bug_page but i'm wondering how this should be done.
You must modify the filter_get_bug_rows function by adding, the custom field.
Two solutions:
- You add only one custom field so you can make a join on the mantis_custom_field_string_table with an order by.
- You add many custom fields so you can create a new query and use the array functions included in PHP.
for example :
$t_temp = result of the normal query
$rows =result of the custom field query
if( is_array($rows) && count($rows)!= 0 ) {
foreach ($rows as $key => $row) {
$t_temp[$key] = $row['Version corrective'];
}
if ( 'DESC' == $t_filter['dir'] ) {
$c_dir = SORT_DESC ;
} else {
$c_dir = SORT_ASC;
}
array_multisort($t_temp, $c_dir, SORT_STRING, $rows);
}
Two solutions:
- You add only one custom field so you can make a join on the mantis_custom_field_string_table with an order by.
- You add many custom fields so you can create a new query and use the array functions included in PHP.
for example :
$t_temp = result of the normal query
$rows =result of the custom field query
if( is_array($rows) && count($rows)!= 0 ) {
foreach ($rows as $key => $row) {
$t_temp[$key] = $row['Version corrective'];
}
if ( 'DESC' == $t_filter['dir'] ) {
$c_dir = SORT_DESC ;
} else {
$c_dir = SORT_ASC;
}
array_multisort($t_temp, $c_dir, SORT_STRING, $rows);
}