How to add a column on the view issues page that will show time spent on fixing each bug?
What I already did:
1. I added a line "require_once( dirname( __FILE__ ) . '/config/custom_functions_inc.php' );" in the file config_defaults_inc.php
2. Created a file custom_functions_inc.php in directory /config/ and put the next content in it:
<?php
if ( !function_exists( 'custom_columns_function' ) ) {
function custom_columns_function( $column_name, $issue_id ) {
if ( $column_name == 'time_spent' ) {
$query = 'SELECT SUM(time_spent) FROM mantis_bug_task WHERE bug_id = ' . $issue_id;
$result = db_query($query);
$time_spent = db_result($result);
return $time_spent ? $time_spent : '0';
}
}
}
function manage_columns_custom( $columns ) {
$columns['time_spent'] = 'Time Spent';
return $columns;
}
?>
3. I expect to see "Time Spent" column in configuration, but it doesn't appeared there.
Here are details about my sustem:
MantisBT Version 2.27.0
Database Schema Version 213
PHP Version 8.3.14
OS Information Linux hosting-1.default-host.net 4.18.0-553.16.1.lve.el8.x86_64 #1 SMP Tue Aug 13 17:45:03 UTC 2024 x86_64
Database Driver mysqli
Database Version, Description 8.0.37, 8.0.37-29
Time Spent on View Issues page
Moderators: Developer, Contributor