diff --git a/core/bug_api.php b/core/bug_api.php index c0b6237..a24f03f 100644 --- a/core/bug_api.php +++ b/core/bug_api.php @@ -1298,29 +1298,42 @@ function bug_format_summary( $p_bug_id, $p_context ) { } /** - * return the timestamp for the most recent time at which a bugnote - * associated with the bug was modified + * Return the timestamp of the most recent bugnote attached to a bug. * @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( 'bugnote' ); $query = "SELECT last_modified - FROM $t_bugnote_table - WHERE bug_id=" . db_param() . " - ORDER BY last_modified DESC"; + FROM $t_bugnote_table + 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 user ID of the author/editor of the most recent bugnote + * attached to or modified within a bug. + * @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( 'bugnote' ); + + $query = "SELECT reporter_id + FROM $t_bugnote_table + WHERE bug_id=" . db_param() . " + ORDER BY last_modified DESC"; + $result = db_query_bound( $query, Array( $c_bug_id ), 1 ); + return db_result( $result ); } /** diff --git a/core/columns_api.php b/core/columns_api.php index 76df895..d2ae256 100644 --- a/core/columns_api.php +++ b/core/columns_api.php @@ -74,6 +74,8 @@ function columns_get_standard() { $t_columns['selection'] = null; $t_columns['edit'] = null; + $t_columns['last_bugnote_reporter'] = null; + $t_columns['last_bugnote_timestamp'] = null; # Overdue icon column (icons appears if an issue is beyond due_date) $t_columns['overdue'] = null; @@ -87,11 +89,11 @@ function columns_get_standard() { if( config_get( 'enable_eta' ) == OFF ) { unset( $t_columns['eta'] ); } - + if( config_get( 'enable_projection' ) == OFF ) { unset( $t_columns['projection'] ); } - + if( config_get( 'enable_product_build' ) == OFF ) { unset( $t_columns['build'] ); } @@ -814,6 +816,34 @@ function print_column_title_overdue( $p_sort, $p_dir, $p_columns_target = COLUMN } /** + * @DELETEME + * @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 ''; + echo lang_get( 'last_bugnote_reporter' ); + echo ''; +} + +/** + * @DELETEME + * @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_timestamp( $p_sort, $p_dir, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { + echo ''; + echo lang_get( 'last_bugnote_timestamp' ); + echo ''; +} + +/** * * @param BugData $p_bug bug obect * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php @@ -1328,3 +1358,41 @@ function print_column_overdue( $p_bug, $p_columns_target = COLUMNS_TARGET_VIEW_P echo ''; } + +/** + * + * @param BugData $p_bug bug obect + * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php + * @return null + * @access public + */ +function print_column_last_bugnote_reporter( $p_bug, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { + echo ''; + + $t_reporter_id = bug_get_last_bugnote_reporter( $p_bug->id ); + + if ( $t_reporter_id > 0 ) { + echo prepare_user_name( $t_reporter_id ); + } + + echo ''; +} + +/** + * + * @param BugData $p_bug bug obect + * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php + * @return null + * @access public + */ +function print_column_last_bugnote_timestamp( $p_bug, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { + echo ''; + + $t_timestamp = bug_get_last_bugnote_timestamp( $p_bug->id ); + + if ( $t_timestamp !== false && $t_timestamp > 0 ) { + echo date( config_get( 'short_date_format' ), $t_timestamp ); + } + + echo ''; +} diff --git a/lang/strings_english.txt b/lang/strings_english.txt index 21829be..6687e0a 100644 --- a/lang/strings_english.txt +++ b/lang/strings_english.txt @@ -1193,6 +1193,8 @@ $s_issue_id = 'Issue #'; $s_recently_visited = 'Recently Visited'; $s_priority_abbreviation = 'P'; $s_note_user_id = 'Note By'; +$s_last_bugnote_reporter = 'Last Bugnote Updated By'; +$s_last_bugnote_timestamp = 'Last Bugnote Timestamp'; # view_all_inc.php $s_none = 'none';