diff -r 04bb28dd6964 core/bug_api.php --- a/core/bug_api.php Fri Sep 25 20:11:21 2009 +0200 +++ b/core/bug_api.php Mon Oct 12 10:49:02 2009 +0200 @@ -1286,11 +1286,11 @@ * return the timestamp for the most recent time at which a bugnote * associated with the bug was modified * @param int p_bug_id integer representing bug id - * @return bool|int false or timestamp in integer format representing newest bugnote timestamp + * @return bool|int false or timestamp in integer format representing last bugnote timestamp * @access public * @uses database_api.php */ -function bug_get_newest_bugnote_timestamp( $p_bug_id ) { +function bug_get_last_bugnote_timestamp( $p_bug_id ) { $c_bug_id = db_prepare_int( $p_bug_id ); $t_bugnote_table = db_get_table( 'mantis_bugnote_table' ); @@ -1299,13 +1299,29 @@ WHERE bug_id=" . db_param() . " ORDER BY last_modified DESC"; $result = db_query_bound( $query, Array( $c_bug_id ), 1 ); - $row = db_result( $result ); + return db_result( $result ); +} - if( false === $row ) { - return false; - } else { - return $row; - } +/** + * return the reporter (user_id) for the most recent time at which a bugnote + * associated with the bug was modified + * @param int p_bug_id integer representing bug id + * @return bool|int false or user id in integer format representing last bugnote reporter + * @access public + * @uses database_api.php + */ +function bug_get_last_bugnote_reporter( $p_bug_id ) { + $c_bug_id = db_prepare_int( $p_bug_id ); + $t_bugnote_table = db_get_table( 'mantis_bugnote_table' ); + + $query = "SELECT MIN(reporter_id) + FROM $t_bugnote_table A + WHERE A.date_submitted = (SELECT MAX(X.date_submitted) + FROM $t_bugnote_table X + WHERE X.bug_id = A.bug_id) AND + A.bug_id=" . db_param(); + $result = db_query_bound( $query, Array( $c_bug_id ), 1 ); + return db_result( $result ); } /** diff -r 04bb28dd6964 core/columns_api.php --- a/core/columns_api.php Fri Sep 25 20:11:21 2009 +0200 +++ b/core/columns_api.php Mon Oct 12 10:49:02 2009 +0200 @@ -74,6 +74,8 @@ $t_columns['selection'] = null; $t_columns['edit'] = null; + $t_columns['last_bugnote_reporter'] = null; + $t_columns['last_bugnote_timestamp'] = null; if( OFF == config_get( 'enable_profiles' ) ) { unset( $t_columns['os'] ); @@ -92,6 +94,13 @@ if( config_get( 'enable_product_build' ) == OFF ) { unset( $t_columns['build'] ); } + + if( config_get( 'enable_last_bugnote_reporter', ON) == OFF ) { + unset( $t_columns['last_bugnote_reporter'] ); + } + if( config_get( 'enable_last_bugnote_timestamp', OFF) == OFF ) { + unset( $t_columns['last_bugnote_timestamp'] ); + } # The following fields are used internally and don't make sense as columns unset( $t_columns['_stats'] ); @@ -802,6 +811,34 @@ /** * + * @param string sort + * @param string direction + * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php + * @return null + * @access public + */ +function print_column_title_last_bugnote_reporter( $p_sort, $p_dir, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { + echo '