View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0010769 | mantisbt | time tracking | public | 2009-07-27 09:14 | 2012-01-27 20:07 |
Reporter | aCCuReRaS | Assigned To | |||
Priority | low | Severity | minor | Reproducibility | always |
Status | new | Resolution | open | ||
Product Version | 1.2.0rc1 | ||||
Summary | 0010769: Time tracking edit is not logged | ||||
Description | When editing a note to change the time, there is no change visible on the revisions of the corresponding note, as the time changes are not logged on the revisions. | ||||
Tags | patch | ||||
Attached Files | timetracking_revisions.patch (5,426 bytes)
From d0b3ed973714b05e531f633677853db9df1fecf7 Mon Sep 17 00:00:00 2001 From: Kornel Lesinski <kornel@aardvarkmedia.co.uk> Date: Mon, 10 May 2010 17:19:52 +0100 Subject: [PATCH 1/2] Added ability to display time tracking bugnote revisions --- bug_revision_view_page.php | 25 ++++++++++++++++++++++--- core/constant_inc.php | 1 + 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/bug_revision_view_page.php b/bug_revision_view_page.php index 0fc0685..b4bd194 100644 --- a/bug_revision_view_page.php +++ b/bug_revision_view_page.php @@ -103,12 +103,15 @@ function show_revision( $t_revision ) { switch( $t_revision['type'] ) { case REV_DESCRIPTION: $t_label = lang_get( 'description' ); + $t_value = string_display_links( $t_revision['value'] ); break; case REV_STEPS_TO_REPRODUCE: $t_label = lang_get( 'steps_to_reproduce' ); + $t_value = string_display_links( $t_revision['value'] ); break; case REV_ADDITIONAL_INFO: $t_label = lang_get( 'additional_information' ); + $t_value = string_display_links( $t_revision['value'] ); break; case REV_BUGNOTE: @@ -121,13 +124,27 @@ function show_revision( $t_revision ) { } $t_label = lang_get( 'bugnote' ); + $t_value = string_display_links( $t_revision['value'] ); break; + case REV_TIME_TRACKING: + + if ( !access_has_bug_level( config_get( 'time_tracking_view_threshold' ), $t_revision['bug_id'] ) ) { + return null; + } + + $t_label = lang_get( 'time_tracking' ); + $t_value = helper_minutes_to_display_format( $t_revision['value'] ); + break; + default: $t_label = ''; + $t_value = ''; } -$t_by_string = sprintf( lang_get( 'revision_by' ), string_display_line( date( config_get( 'normal_date_format' ), $t_revision['timestamp'] ) ), string_display_line( user_get_name( $t_revision['user_id'] ) ) ); + $t_by_string = sprintf( lang_get( 'revision_by' ), + string_display_line( date( config_get( 'normal_date_format' ), $t_revision['timestamp'] ) ), + string_display_line( user_get_name( $t_revision['user_id'] ) ) ); ?> <tr class="spacer"><td><a id="revision-<?php echo $t_revision['id'] ?>"></a></td></tr> @@ -143,7 +160,7 @@ $t_by_string = sprintf( lang_get( 'revision_by' ), string_display_line( date( co <tr <?php echo helper_alternate_class() ?>> <th class="category"><?php echo $t_label ?></th> -<td colspan="3"><?php echo string_display_links( $t_revision['value'] ) ?></td> +<td colspan="3"><?php echo $t_value ?></td> </tr> <?php @@ -157,7 +174,7 @@ print_recently_visited(); <br/> <table class="width100" cellspacing="1"> - +<thead> <tr> <td class="form-title" colspan="2"><?php echo lang_get( 'view_revisions' ), ': ', $t_title ?></td> <td class="right" colspan="2"> @@ -172,11 +189,13 @@ print_bracket_link( 'view.php?id=' . $t_bug_id, lang_get( 'back_to_issue' ) ); <th class="category" width="15%"><?php echo lang_get( 'summary' ) ?></th> <td colspan="3"><?php echo bug_format_summary( $t_bug_id, SUMMARY_FIELD ) ?></td> </tr> +</thead><tbody> <?php foreach( $t_bug_revisions as $t_rev ) { show_revision( $t_rev ); } ?> +</tbody> </table> <?php diff --git a/core/constant_inc.php b/core/constant_inc.php index a53e19f..1f9b106 100644 --- a/core/constant_inc.php +++ b/core/constant_inc.php @@ -197,6 +197,7 @@ define( 'REV_DESCRIPTION', 1 ); define( 'REV_STEPS_TO_REPRODUCE', 2 ); define( 'REV_ADDITIONAL_INFO', 3 ); define( 'REV_BUGNOTE', 4 ); +define( 'REV_TIME_TRACKING', 5 ); # bug relationship constants define( 'BUG_DUPLICATE', 0 ); -- 1.7.0.2 From fd96600b7f5479cecc90b0d55556bf58e4445415 Mon Sep 17 00:00:00 2001 From: Kornel Lesinski <kornel@aardvarkmedia.co.uk> Date: Mon, 10 May 2010 17:20:18 +0100 Subject: [PATCH 2/2] Added logging of bugnote time tracking changes --- core/bugnote_api.php | 18 ++++++++++++++++-- 1 files changed, 16 insertions(+), 2 deletions(-) diff --git a/core/bugnote_api.php b/core/bugnote_api.php index 88d3987..e2ed410 100644 --- a/core/bugnote_api.php +++ b/core/bugnote_api.php @@ -480,13 +480,27 @@ function bugnote_get_all_bugnotes( $p_bug_id ) { */ function bugnote_set_time_tracking( $p_bugnote_id, $p_time_tracking ) { $c_bugnote_id = db_prepare_int( $p_bugnote_id ); - $c_bugnote_time_tracking = helper_duration_to_minutes( $p_time_tracking ); + $c_bugnote_new_time_tracking = helper_duration_to_minutes( $p_time_tracking ); $t_bugnote_table = db_get_table( 'bugnote' ); + $t_old_time_tracking = bugnote_get_field( $p_bugnote_id, 'time_tracking' ); + + if ($t_old_time_tracking == $c_bugnote_new_time_tracking) { + return false; + } + $query = "UPDATE $t_bugnote_table SET time_tracking = " . db_param() . " WHERE id=" . db_param(); - db_query_bound( $query, Array( $c_bugnote_time_tracking, $c_bugnote_id ) ); + db_query_bound( $query, Array( $c_bugnote_new_time_tracking, $c_bugnote_id ) ); + + # insert a new revision + $t_user_id = auth_get_current_user_id(); + $t_bug_id = bugnote_get_field( $p_bugnote_id, 'bug_id' ); + $t_revision_id = bug_revision_add( $t_bug_id, $t_user_id, REV_TIME_TRACKING, $t_old_time_tracking, $p_bugnote_id ); + + # log new bugnote + history_log_event_special( $t_bug_id, BUGNOTE_UPDATED, bugnote_format_id( $p_bugnote_id ), $t_revision_id ); # db_query errors if there was a problem so: return true; -- 1.7.0.2 | ||||
OK I gave this a try but decided that the current time tracking system is not going to make this work nicely. I suggest that this should be a feature included with John's Timecard plugin which has a better architecture for supporting this feature. |
|
I've fixed that. It's not pretty, but it's better than losing data. |
|
seems to be solved in 1.2.8. and timecard has created a new field time spent, while the initial field becomes total time. since the initial field was time spent earlier, the billing page will show estimated billing instead of spent billing like before. that is suitable for some but not what I expected |
|
I don't think it is. What makes you say that ?
This is a different topic. Please report issues on Timecard plugin on the author's bugtracker http://leetcode.net/mantis/ |
|
well, using the core time reporting, a note is created each time I time report, so I could see a history record be made. Thus saying this was solved. But Since I've turned it off and use the time reporting plugin now, I am quite happy a note is not made, and no history record either. It was quite a mess. Actually I'd like to object and say time reports should NOT be recorded as part of the issue history. I suggest a time report status field instead, addressing the security aspects of time reporting. That way time reports can be open, submitted for review approved or archived. A time reporter should be free to change his reports in the open status without it being recorded, and managers should not be able to modify it beside changing the status. this way its also good as a privacy point of view. Let me know if we can add this to the plugin ;) |
|