View Issue Details

IDProjectCategoryView StatusLast Update
0004428mantisbttime trackingpublic2016-02-24 03:43
Reportermrizman Assigned Todavidnewcomb  
PrioritynormalSeverityfeatureReproducibilityN/A
Status closedResolutionfixed 
Target Version1.1.0Fixed in Version1.1.0a3 
Summary0004428: Time Tracking
Description

It would be very useful if mantis could track time spent to solve issues.

Additional Information

Here's my idea on how it should work. Each issue should have an attached list with following attributes:

  • date + time spent (in hours)
    OR
    date + start time + end time
  • mantis user
  • type of activity (research, programming etc.)
  • maybe custom fields

Type of activity should be configurable. Mantis should also calculate total time that was spent on specific issue, on specific component and on specific project in some period of time.

TagsNo tags attached.
Attached Files
mantis_time.patch (21,423 bytes)   
? billing_inc.php
? billing_page.php
? bugnote_stats_inc.php
? error.log
? z_time_taken.sql
? core/filter_api.phpx
Index: bug_reminder.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/bug_reminder.php,v
retrieving revision 1.18
diff -u -r1.18 bug_reminder.php
--- bug_reminder.php	12 Feb 2005 20:01:04 -0000	1.18
+++ bug_reminder.php	3 May 2005 18:06:42 -0000
@@ -57,7 +57,7 @@
 			$f_to = $t_to;
 		}
 		$t_attr = '|' . implode( '|', $f_to ) . '|';
-		bugnote_add( $f_bug_id, $f_body, config_get( 'default_reminder_view_status' ) == VS_PRIVATE, REMINDER, $t_attr );
+		bugnote_add( $f_bug_id, $f_body, 0, config_get( 'default_reminder_view_status' ) == VS_PRIVATE, REMINDER, $t_attr );
 	}
 
 	html_page_top1();
Index: bug_update.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/bug_update.php,v
retrieving revision 1.83
diff -u -r1.83 bug_update.php
--- bug_update.php	26 Apr 2005 14:35:21 -0000	1.83
+++ bug_update.php	3 May 2005 18:06:58 -0000
@@ -66,6 +66,7 @@
 
 	$f_private						= gpc_get_bool( 'private' );
 	$f_bugnote_text					= gpc_get_string( 'bugnote_text', '' );
+	$f_time_taken					= gpc_get_string( 'time_taken', '0:00' );
 	$f_close_now					= gpc_get_string( 'close_now', false );
 
 	# Handle auto-assigning
@@ -169,7 +170,7 @@
 
 	# Add a bugnote if there is one
 	if ( ( !is_blank( $f_bugnote_text ) ) && ( false == $t_bug_note_set ) ) {
-		bugnote_add( $f_bug_id, $f_bugnote_text, $f_private );
+		bugnote_add( $f_bug_id, $f_bugnote_text, $f_time_taken, $f_private );
 	}
 
 	# Update the bug entry, notify if we haven't done so already
Index: bug_update_advanced_page.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/bug_update_advanced_page.php,v
retrieving revision 1.85
diff -u -r1.85 bug_update_advanced_page.php
--- bug_update_advanced_page.php	1 May 2005 16:20:22 -0000	1.85
+++ bug_update_advanced_page.php	3 May 2005 18:07:06 -0000
@@ -494,6 +494,18 @@
 </tr>
 <?php } ?>
 
+<!-- Bugnote Time Taken (if permitted) -->
+<?php if ( access_has_bug_level( config_get( 'private_bugnote_threshold' ), $f_bug_id ) ) { ?>
+<tr <?php echo helper_alternate_class() ?>>
+	<td class="category">
+		<?php echo lang_get( 'time_taken' ) ?>
+	</td>
+	<td colspan="5">
+		<input type="text" name="time_taken" size="5" value="0:00" />
+	</td>
+</tr>
+<?php } ?>
+
 
 <!-- Submit Button -->
 <tr>
Index: bug_update_page.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/bug_update_page.php,v
retrieving revision 1.88
diff -u -r1.88 bug_update_page.php
--- bug_update_page.php	12 Feb 2005 20:01:05 -0000	1.88
+++ bug_update_page.php	3 May 2005 18:07:18 -0000
@@ -388,6 +388,17 @@
 	</td>
 </tr>
 <?php } ?>
+<!-- Bugnote Time Taken (if permitted) -->
+<?php if ( access_has_bug_level( config_get( 'private_bugnote_threshold' ), $f_bug_id ) ) { ?>
+<tr <?php echo helper_alternate_class() ?>>
+	<td class="category">
+		<?php echo lang_get( 'time_taken' ) ?>
+	</td>
+	<td colspan="5">
+		<input type="text" name="time_taken" size="5" value="0:00" />
+	</td>
+</tr>
+<?php } ?>
 
 
 <!-- Submit Button -->
Index: bug_view_page.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/bug_view_page.php,v
retrieving revision 1.72
diff -u -r1.72 bug_view_page.php
--- bug_view_page.php	12 Feb 2005 20:01:05 -0000	1.72
+++ bug_view_page.php	3 May 2005 18:07:26 -0000
@@ -421,6 +421,11 @@
 	<br />
 <?php } ?>
 <?php
+	# Work break-down
+	$f_bugnote_stats = 1;
+	if ( $f_bugnote_stats ) {
+		include( $t_mantis_dir . 'bugnote_stats_inc.php' );
+	}
 	# History
 	if ( $f_history ) {
 		include( $t_mantis_dir . 'history_inc.php' );
Index: bugnote_add.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/bugnote_add.php,v
retrieving revision 1.45
diff -u -r1.45 bugnote_add.php
--- bugnote_add.php	12 Feb 2005 20:01:05 -0000	1.45
+++ bugnote_add.php	3 May 2005 18:07:39 -0000
@@ -23,6 +23,7 @@
 <?php
 	$f_bug_id		= gpc_get_int( 'bug_id' );
 	$f_private		= gpc_get_bool( 'private' );
+	$f_time_taken		= gpc_get_string( 'time_taken', '0:00' );
 	$f_bugnote_text	= gpc_get_string( 'bugnote_text', '' );
 
 	if ( bug_is_readonly( $f_bug_id ) ) {
@@ -36,7 +37,7 @@
 
 	# check for blank bugnote
 	if ( !is_blank( $f_bugnote_text ) ) {
-		bugnote_add( $f_bug_id, $f_bugnote_text, $f_private );
+		bugnote_add( $f_bug_id, $f_bugnote_text, $f_time_taken, $f_private);
 		email_bugnote_add( $f_bug_id );
 	}
 
Index: bugnote_add_inc.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/bugnote_add_inc.php,v
retrieving revision 1.25
diff -u -r1.25 bugnote_add_inc.php
--- bugnote_add_inc.php	26 Apr 2005 18:22:57 -0000	1.25
+++ bugnote_add_inc.php	3 May 2005 18:07:45 -0000
@@ -69,6 +69,14 @@
 	</td>
 </tr>
 <?php } ?>
+<tr class="row-2">
+	<td class="category">
+		<?php echo lang_get( 'time_taken' ) ?>
+	</td>
+	<td>
+		<input type="text" name="time_taken" size="5" value="0:00" />
+	</td>
+</tr>
 <tr>
 	<td class="center" colspan="2">
 		<input type="submit" class="button" value="<?php echo lang_get( 'add_bugnote_button' ) ?>" />
Index: bugnote_edit_page.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/bugnote_edit_page.php,v
retrieving revision 1.48
diff -u -r1.48 bugnote_edit_page.php
--- bugnote_edit_page.php	12 Feb 2005 20:01:05 -0000	1.48
+++ bugnote_edit_page.php	3 May 2005 18:08:00 -0000
@@ -50,6 +50,8 @@
 	}
 
 	$t_bugnote_text = string_textarea( bugnote_get_text( $f_bugnote_id ) );
+	$t_time_taken = bugnote_get_field( $f_bugnote_id, "time_taken" );
+	$t_time_taken = db_convert_time( $t_time_taken );
 
 	# Determine which view page to redirect back to.
 	$t_redirect_url = string_get_bug_view_url( $t_bug_id );
@@ -75,6 +77,12 @@
 		<textarea cols="80" rows="10" name="bugnote_text" wrap="virtual"><?php echo $t_bugnote_text ?></textarea>
 	</td>
 </tr>
+<tr class="row-2">
+	<td class="center" colspan="2">
+		<b><?php echo lang_get( 'time_taken') ?> (HH:MM)</b><br />
+		<input type="text" name="time_taken" size="5" value="<?php echo $t_time_taken ?>" />
+	</td>
+</tr>
 <tr>
 	<td class="center" colspan="2">
 		<input type="submit" class="button" value="<?php echo lang_get( 'update_information_button' ) ?>" />
Index: bugnote_update.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/bugnote_update.php,v
retrieving revision 1.43
diff -u -r1.43 bugnote_update.php
--- bugnote_update.php	12 Feb 2005 20:01:05 -0000	1.43
+++ bugnote_update.php	3 May 2005 18:08:08 -0000
@@ -24,6 +24,7 @@
 <?php
 	$f_bugnote_id	= gpc_get_int( 'bugnote_id' );
 	$f_bugnote_text	= gpc_get_string( 'bugnote_text', '' );
+	$f_time_taken	= gpc_get_string( 'time_taken', '0:00' );
 
 	# Check if the current user is allowed to edit the bugnote
 	$t_user_id = auth_get_current_user_id();
@@ -43,6 +44,7 @@
 	$f_bugnote_text = trim( $f_bugnote_text ) . "\n\n";
 
 	bugnote_set_text( $f_bugnote_id, $f_bugnote_text );
+	bugnote_set_time_taken( $f_bugnote_id, $f_time_taken );
 
 	print_successful_redirect( string_get_bug_view_url( $t_bug_id ) . '#bugnotes' );
 ?>
Index: bugnote_view_inc.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/bugnote_view_inc.php,v
retrieving revision 1.29
diff -u -r1.29 bugnote_view_inc.php
--- bugnote_view_inc.php	1 May 2005 02:30:42 -0000	1.29
+++ bugnote_view_inc.php	3 May 2005 18:08:14 -0000
@@ -102,6 +102,9 @@
 		$v3_note = $row['note'];
 		$v3_note = string_display_links( $v3_note );
 		$t_bugnote_id_formatted = bugnote_format_id( $v3_id );
+		$v3_time_taken = db_convert_time( $v3_time_taken );
+		if ( "" != $v3_time_taken )
+			$v3_time_taken = "[ $v3_time_taken ]";
 
 		if ( VS_PRIVATE == $v3_view_state ) {
 			$t_bugnote_css		= 'bugnote-private';
@@ -122,6 +125,7 @@
 		<?php } ?>
 		<br />
 		<span class="small"><?php echo $v3_date_submitted ?></span><br />
+		<span class="small"><?php echo $v3_time_taken ?></span><br />
 		<?php
 		if ( true == $t_bugnote_modified ) {
 			echo '<span class="small">'.lang_get( 'edited_on').' '.$v3_last_modified.'</span><br />';
Index: print_all_bug_options_inc.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/print_all_bug_options_inc.php,v
retrieving revision 1.24
diff -u -r1.24 print_all_bug_options_inc.php
--- print_all_bug_options_inc.php	10 Aug 2004 10:46:12 -0000	1.24
+++ print_all_bug_options_inc.php	3 May 2005 18:08:39 -0000
@@ -46,7 +46,8 @@
 	                       	'attached_files',
 	                       	'bugnote_title',
 	                       	'bugnote_date',
-	                       	'bugnote_description' );
+	                       	'bugnote_description',
+				'time_taken' );
 }
 
 
Index: print_all_bug_page_excel.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/print_all_bug_page_excel.php,v
retrieving revision 1.46
diff -u -r1.46 print_all_bug_page_excel.php
--- print_all_bug_page_excel.php	22 Apr 2005 22:27:50 -0000	1.46
+++ print_all_bug_page_excel.php	3 May 2005 18:08:49 -0000
@@ -358,8 +358,8 @@
 		}# if index
 	$name_index++;
 ?>
-<?php # Bugnotes BEGIN (3 rows) ?>
-<td colspan="3">
+<?php # Bugnotes BEGIN (4 rows) ?>
+<td colspan=4>
 <?php  # print bugnotes
 		# get the bugnote data
  		if ( !access_has_bug_level( config_get( 'private_bugnote_threshold' ), $v_id ) ) {
@@ -387,6 +387,7 @@
 			$row = db_fetch_array( $result6 );
 			extract( $row, EXTR_PREFIX_ALL, 'v3' );
 			$v3_date_submitted = date( config_get( 'normal_date_format' ), ( db_unixtimestamp( $v3_date_submitted ) ) );
+			$v3_time_taken = date( config_get( 'normal_date_format' ), ( db_unixtimestamp( $v3_time_taken ) ) );
 
 			# grab the bugnote text and id and prefix with v3_
 			$query6 = "SELECT note, id
@@ -437,6 +438,13 @@
 		  echo "</td>";
 			}
 	$bugnote_index++;  ?>
+
+	<?php if ( ( $bugnote_index < $field_name_count ) && ( !isset( $t_prefs[$bugnote_index] )||( 1 == $t_prefs[$bugnote_index] ) ) ) { ?>
+	<td class=xl2216681 nowrap style='border-top:none;border-left:none'>
+	<?php echo $v3_time_taken;
+		  echo "</td>";
+			}
+	$bugnote_index++;  ?>
 </tr>
 </table>
 	<?php
Index: summary_page.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/summary_page.php,v
retrieving revision 1.45
diff -u -r1.45 summary_page.php
--- summary_page.php	27 Apr 2005 02:20:13 -0000	1.45
+++ summary_page.php	3 May 2005 18:09:04 -0000
@@ -182,9 +182,9 @@
 		<br />
 
 		<?php # MISCELLANEOUS # ?>
-		<table class="width100">
+		<table class="width100" cellspacing="1">
 		<tr>
-			<td class="form-title" colspan="5">
+			<td class="form-title" colspan="2">
 				<?php echo lang_get( 'time_stats' ) ?>
 			</td>
 		</tr>
Index: core/bugnote_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/bugnote_api.php,v
retrieving revision 1.35
diff -u -r1.35 bugnote_api.php
--- core/bugnote_api.php	24 Mar 2005 02:55:22 -0000	1.35
+++ core/bugnote_api.php	3 May 2005 18:26:16 -0000
@@ -29,6 +29,7 @@
 		var $view_state;
 		var $date_submitted;
 		var $last_modified;
+		var $time_taken;
 		var $note_type;
 		var $note_attr;
 	}
@@ -86,12 +87,13 @@
 	# Add a bugnote to a bug
 	#
 	# return the ID of the new bugnote
-	function bugnote_add ( $p_bug_id, $p_bugnote_text, $p_private = false, $p_type = 0, $p_attr = '' ) {
+	function bugnote_add ( $p_bug_id, $p_bugnote_text, $p_time_taken = '0:00', $p_private = false, $p_type = 0, $p_attr = '' ) {
 		$c_bug_id            	= db_prepare_int( $p_bug_id );
 		$c_bugnote_text      	= db_prepare_string( $p_bugnote_text );
+		$c_time_taken      	= db_prepare_string( $p_time_taken );
 		$c_private           	= db_prepare_bool( $p_private );
 		$c_type            	= db_prepare_int( $p_type );
-		$c_attr      	= db_prepare_string( $p_attr );
+		$c_attr          	= db_prepare_string( $p_attr );
 
 		$t_bugnote_text_table	= config_get( 'mantis_bugnote_text_table' );
 		$t_bugnote_table     	= config_get( 'mantis_bugnote_table' );
@@ -118,9 +120,9 @@
 
 		# insert bugnote info
 		$query = "INSERT INTO $t_bugnote_table
-		          		(bug_id, reporter_id, bugnote_text_id, view_state, date_submitted, last_modified, note_type, note_attr )
-		          	 VALUES
-		          		('$c_bug_id', '$t_user_id','$t_bugnote_text_id', '$t_view_state', " . db_now() . "," . db_now() . ", '$c_type', '$c_attr')";
+	          		(bug_id, reporter_id, bugnote_text_id, view_state, date_submitted, last_modified, note_type, note_attr, time_taken )
+	          	 VALUES
+				('$c_bug_id', '$t_user_id','$t_bugnote_text_id', '$t_view_state', " . db_now() . "," . db_now() . ", '$c_type', '$c_attr', '$c_time_taken')";
 		db_query( $query );
 
 		# get bugnote id
@@ -324,6 +326,7 @@
 				$t_bugnote->last_modified = db_unixtimestamp( $row['last_modified'] );
 				$t_bugnote->note_type     = $row['note_type'];
 				$t_bugnote->note_attr     = $row['note_attr'];
+				$t_bugnote->time_taken    = $row['time_taken'];
 
 				$t_bugnotes[] = $t_bugnote;
 			}
@@ -338,6 +341,22 @@
 	#===================================
 
 	# --------------------
+	# Update the time_taken field of the bugnote
+	function bugnote_set_time_taken( $p_bugnote_id, $p_time_taken ) {
+		$c_bugnote_id		= db_prepare_int( $p_bugnote_id );
+		$c_bugnote_time_taken	= db_prepare_string( $p_time_taken );
+		$t_bugnote_table	= config_get( 'mantis_bugnote_table' );
+
+		$query = "UPDATE $t_bugnote_table
+		          	SET time_taken = '$c_bugnote_time_taken'
+		          	WHERE id='$c_bugnote_id'";
+		db_query( $query );
+
+		# db_query() errors if there was a problem so:
+		return true;
+	}
+
+	# --------------------
 	# Update the last_modified field of the bugnote
 	function bugnote_date_update( $p_bugnote_id ) {
 		$c_bugnote_id		= db_prepare_int( $p_bugnote_id );
@@ -411,4 +430,86 @@
 
 		return str_pad( $p_bugnote_id, $t_padding, '0', STR_PAD_LEFT );
 	}
+
+	
+	#===================================
+	# Bugnote Stats
+	#===================================
+
+	# --------------------
+	# Returns an array of bugnote stats
+	function bugnote_stats_get_events_array( $p_bugnote_id, $p_from, $p_to ) {
+		// MySQL
+		$t_user_table = config_get( 'mantis_user_table' );
+		$t_bugnote_table = config_get( 'mantis_bugnote_table' );
+		
+		if ( "" != $p_from ) {
+			$t_ar = explode( "/", $p_from ); # Expecting mm/dd/yyyy
+			$t_from = $t_ar[2] ."-". $t_ar[0] ."-". $t_ar[1];
+			$c_from = " AND bn.date_submitted > '$t_from' ";
+		}
+		if ( "" != $p_to ) {
+			$t_ar = explode( "/", $p_to ); # Expecting mm/dd/yyyy
+			$t_to = $t_ar[2] ."-". $t_ar[0] ."-". $t_ar[1];
+			$c_to = " AND bn.date_submitted < '$t_to' ";
+		}
+		$t_results = array();
+
+		$query = "SELECT username, 
+				TIME_FORMAT(SEC_TO_TIME(SUM(TIME_TO_SEC(time_taken))),'%H:%i') sum_time_taken
+				FROM $t_user_table u, $t_bugnote_table bn
+				WHERE u.id = bn.reporter_id AND
+				      bn.bug_id = '$p_bugnote_id'
+				      $c_from $c_to
+				GROUP BY u.id";
+//die("sql=$query|");
+		$result	= db_query($query);
+		while ($row = db_fetch_array($result)) {
+			$t_results[] = $row;
+		}
+
+		return $t_results;
+	}
+
+	# --------------------
+	# Returns an array of bugnote stats
+	function bugnote_stats_get_project_array( $p_project_id, $p_from, $p_to, $p_cost ) {
+		// MySQL
+		$t_user_table = config_get( 'mantis_user_table' );
+		$t_bugnote_table = config_get( 'mantis_bugnote_table' );
+
+		if ( "" != $p_from ) {
+			$t_ar = explode( "/", $p_from ); # Expecting mm/dd/yyyy
+			$t_from = $t_ar[2] ."-". $t_ar[0] ."-". $t_ar[1];
+			$c_from = " AND bn.date_submitted > '$t_from' ";
+		}
+		if ( "" != $p_to ) {
+			$t_ar = explode( "/", $p_to ); # Expecting mm/dd/yyyy
+			$t_to = $t_ar[2] ."-". $t_ar[0] ."-". $t_ar[1];
+			$c_to = " AND bn.date_submitted < '$t_to' ";
+		}
+		if ( ALL_PROJECTS != $p_project_id ) {
+			$c_project = " AND b.project_id = '$p_project_id' AND bn.bug_id = b.id ";
+			$t_bug_table = ", ". config_get( 'mantis_bug_table' ). " b";
+		}
+		$t_results = array();
+
+		$query = "SELECT username, bn.bug_id, TIME_FORMAT(SEC_TO_TIME(SUM(TIME_TO_SEC(time_taken))),'%H:%i') sum_time_taken
+				FROM $t_user_table u, $t_bugnote_table bn $t_bug_table
+				WHERE u.id = bn.reporter_id AND bn.time_taken != 0
+				      $c_project $c_from $c_to
+				GROUP BY bn.bug_id, u.id";
+		$result	= db_query($query);
+		$t_cost_min = $p_cost / 60;
+		while ($row = db_fetch_array($result)) {
+			$ar = explode(":", $row[sum_time_taken]);
+			$t_total_cost = ($ar[0] * $p_cost) + ($ar[1] * $t_cost_min);
+			$row['cost'] = number_format($t_total_cost, 2);
+			$t_results[] = $row;
+		}
+
+		return $t_results;
+	}
+
+	
 ?>
Index: core/custom_function_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/custom_function_api.php,v
retrieving revision 1.19
diff -u -r1.19 custom_function_api.php
--- core/custom_function_api.php	1 May 2005 16:20:23 -0000	1.19
+++ core/custom_function_api.php	3 May 2005 18:26:25 -0000
@@ -67,7 +67,7 @@
 	function custom_function_default_checkin( $p_issue_id, $p_comment, $p_file, $p_new_version ) {
 		if ( bug_exists( $p_issue_id ) ) {
 			history_log_event_special( $p_issue_id, CHECKIN, $p_file, $p_new_version );
-			bugnote_add( $p_issue_id, $p_comment, VS_PRIVATE == config_get( 'source_control_notes_view_status' ) );
+			bugnote_add( $p_issue_id, $p_comment, 0, VS_PRIVATE == config_get( 'source_control_notes_view_status' ) );
 
 			$t_status = config_get( 'source_control_set_status_to' );
 			if ( OFF != $t_status ) {
Index: core/database_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/database_api.php,v
retrieving revision 1.42
diff -u -r1.42 database_api.php
--- core/database_api.php	26 Feb 2005 15:16:46 -0000	1.42
+++ core/database_api.php	3 May 2005 18:26:33 -0000
@@ -270,6 +270,17 @@
 				trigger_error( ERROR_CONFIG_OPT_INVALID, ERROR );
 		}
 	}
+	# --------------------
+	# prepare a string before DB insertion
+	# @@@ should default be return addslashes( $p_string ); or generate an error
+	function db_convert_time( $p_hhmmss ) {
+		// MySQL
+		if ( "" == $p_hhmmss || "00:00:00" == $p_hhmmss ) {
+			return "";
+		}
+		$t_a = explode(":", $p_hhmmss);
+		return $t_a[0] . ":". $t_a[1];
+	}
 
 	# --------------------
 	# prepare an integer before DB insertion
Index: core/html_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/html_api.php,v
retrieving revision 1.165
diff -u -r1.165 html_api.php
--- core/html_api.php	1 May 2005 02:35:07 -0000	1.165
+++ core/html_api.php	3 May 2005 18:26:42 -0000
@@ -524,6 +524,7 @@
 				# Add custom options
 				$t_custom_options = prepare_custom_menu_options( 'main_menu_custom_options' );
 				$t_menu_options = array_merge( $t_menu_options, $t_custom_options );
+				$t_menu_options[] = '<a href="billing_page.php">' . lang_get( 'billing_link' ) . '</a>';
 
 				# Logout (no if anonymously logged in)
 				if ( !current_user_is_anonymous() ) {
Index: javascript/common.js
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/javascript/common.js,v
retrieving revision 1.6
diff -u -r1.6 common.js
--- javascript/common.js	12 Feb 2005 20:03:50 -0000	1.6
+++ javascript/common.js	3 May 2005 18:26:52 -0000
@@ -85,6 +85,7 @@
 var g_div_history		= 0x0001;
 var g_div_bugnotes		= 0x0002;
 var g_div_bugnote_add	= 0x0004;
+var g_div_bugnotestats  = 0x0008;
 var g_div_upload_form	= 0x0010;
 var g_div_monitoring	= 0x0020;
 var g_div_sponsorship	= 0x0040;
Index: lang/strings_english.txt
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/lang/strings_english.txt,v
retrieving revision 1.256
diff -u -r1.256 strings_english.txt
--- lang/strings_english.txt	1 May 2005 14:53:49 -0000	1.256
+++ lang/strings_english.txt	3 May 2005 18:27:01 -0000
@@ -834,6 +834,7 @@
 $s_edit_news_link = 'Edit News';
 $s_docs_link = 'Docs';
 $s_logout_link = 'Logout';
+$s_billing_link = 'Billing';
 $s_my_view_link = 'My View';
 
 # meta_inc.php
@@ -1256,4 +1257,12 @@
 $s_after = 'After' ;
 $s_on_or_after = 'On Or After' ;
 
+
+// New ones
+$s_time_taken = 'Time taken';
+$s_bugnote_stats = 'Bugnote Statistics';
+$s_get_bugnote_stats_button = 'Get bugnote statistics';
+$s_cost_per_hour = 'Cost / Hour (&pound;)';
+$s_cost = 'Cost';
+
 ?>
mantis_time.patch (21,423 bytes)   
mantisbt-time_taken.zip (13,836 bytes)
SumTask.png (5,931 bytes)   
SumTask.png (5,931 bytes)   
Effort_ViewSimple.png (1,808 bytes)   
Effort_ViewSimple.png (1,808 bytes)   
single_file_time_tracker.png (4,549 bytes)   
single_file_time_tracker.png (4,549 bytes)   

Relationships

has duplicate 0005231 closedthraxisp Time tracker 
has duplicate 0000113 closedprescience Could we have a field for time taken when entering a bug note. 
has duplicate 0007123 closedvboctor Billing in Mantis 1.0.1 
has duplicate 0004888 closedgiallu Attach a time amount to an issue 
related to 0004217 new Issue progress bar 
related to 0004968 closedvboctor Add field for effort (costs) to fix bug 
related to 0007945 new Time tracking vs. time planning 
related to 0020625 acknowledged Inconsistent time tracking permissions 

Activities

stevemagruder

stevemagruder

2004-12-29 00:11

reporter   ~0008820

In general, sounds like a good idea. I was needing this today. So, I just added "Est. time (hrs.)" and "Actual time (hrs.)" custom float fields for starters.

johnwebbcole

johnwebbcole

2005-02-14 09:24

reporter   ~0009306

There was code posted to the mailing list in December (Daily Reports) that added time tracking http://sourceforge.net/mailarchive/forum.php?thread_id=6210477&forum_id=3264

It would be very nice to get this added to the cvs HEAD as this would really fit into a lot of peoples work methods. We need to replace a commercial issue/help tracking package and this is the last piece that new need, time tracking, to replace it with mantis.

johnwebbcole

johnwebbcole

2005-02-22 12:59

reporter   ~0009361

Reminder sent to: vboctor

Victor,
I think this was your post: http://sourceforge.net/mailarchive/forum.php?thread_id=6210477&forum_id=3264 that had the code for daily reports. Could I get a copy of this? The forum doesn't save the attachments, or could you upload it to an issue?

Thanks,

John Cole

johnwebbcole

johnwebbcole

2005-03-05 11:52

reporter   ~0009484

Any news on this? If I could get the code from the mail archive, I'd be happy to get it working on CVS HEAD and resubmit a patch.

Thanks,

John

vboctor

vboctor

2005-03-13 16:28

manager   ~0009522

I attached a patch that was provided by David Newcomb through the mantisbt-dev mailing list. The patch is against Mantis 0.19.2.

I haven't tested this patch in any way (yet!).

johnwebbcole

johnwebbcole

2005-05-03 15:05

reporter   ~0010021

I've attached a patch to the current cvs head (1.0.0a3-CVS) that gets the tgz file up to date. Note that there are some files needed from the mantis-0.19.2-time_taken.tgz file attached to this issue.

This works ok for our purposes. Some notes about some of it's odditys:

  • If you enter '30' into the time field, it is interpreted as 30 seconds
  • If you enter '1:30' it is one hour and 30 minutes
  • If you enter '0:30' it is 30 seconds

The safest way to enter time is hh:mm:ss

davidnewcomb

davidnewcomb

2005-05-04 05:26

reporter   ~0010027

Is there any likelyhood that this functionality will be incorporated into the main source?
In the mean time, I will have a look at correcting the time_taken input issue.
How about:

  • "30" = 30 minutes
  • "1:30" = 1 hour 30 minutes
  • "0:30" = 0 hours 30 minutes
  • "1:30:45" = 1 hr 30 mi 45s
    [although I doubt anyone does per second billing, yet!]
ralfiii

ralfiii

2005-05-04 06:28

reporter   ~0010028

I'd even say 5 -> 5hrs
the rest could (for me) remain as davidnewcomb suggested

johnwebbcole

johnwebbcole

2005-05-04 12:15

reporter   ~0010029

Something that would increase the odds of this getting put into the main cvs tree would be an option to hide/show the time fields and reports. At least it could then be considered experimental and defaulted to off (like lots of other features).

Other configs could include:

  • default single integer value (hours or minutes, so if you entered 5 you could configure it to determine if it is hours or minutes)
  • option to hide the rate stuff (if your only tracking time and not billing)
  • pie in the sky stuff - a javascript stopwatch so a CSR could push a button and time a call :-)
oernii

oernii

2005-05-24 11:51

reporter   ~0010206

I am voting for this one too.

davidnewcomb

davidnewcomb

2005-05-25 06:05

reporter   ~0010217

Last edited: 2005-05-25 12:03

Hi all,

Finally got around to upgrading to the latest version - mantis-1.0.0a2. While upgrading I took the opportunity to add all the suggestions that were made above.
This bugnote would not let be upload a 1.4MB file, so I have placed the files on my server with some change notes.

http://www.bigsoft.co.uk/projects/mantis/mantis-1.0.0a2-time_taken.html

I have also created a demo that you can play on:

http://www.bigsoft.co.uk/projects/mantis/mantis-1.0.0a2-time_taken/login_page.php

There are 2 users to play with:

joebloggs (for the uk people)
johndoe (for the us people)

The passwords are the same as the usernames.

ps. can any of you tell me the magic incantation that creates and applies patch files (like the one that johnwebbcole created previously)

Enjoy.

davidnewcomb

davidnewcomb

2005-05-25 06:16

reporter   ~0010218

I would still like to get this time_taken extension into the main source. What do I have to do next? If no one wants to do it I am prepared to do the changes myself.

ryandesign

ryandesign

2005-05-25 06:27

reporter   ~0010219

Last edited: 2005-05-25 06:29

If you've checked out the Mantis code from CVS, then to get a diff, you run this command in the root of the working copy:

cvs diff -u > /path/to/your/patch/file.patch

...where /path/to/your/patch/file.patch is the patch file that will be created.

It sounds like you've just downloaded 1.0.0a2 though and made your changes to it. In that case, make another copy of 1.0.0a2 from the original tarball and get a difference between it and your modified copy. You probably want to copy your config file to the pristine copy too. If you have directories "mantis-1.0.0a2-pristine" and "mantis-1.0.0a2-davidnewcomb" in the same directory, then do this:

diff -ru mantis-1.0.0a2-pristine mantis-1.0.0a2-davidnewcomb > /path/to/your/patch/file.patch

These commands are for Unix-like systems (Linux, BSD, Mac OS X, etc.); I can't help you if you use Windows.

davidnewcomb

davidnewcomb

2005-05-25 08:35

reporter   ~0010221

Thanks ryandesign. I just download a 1.0.0a2 from the site. The released versions are stable and tagged, as most of the people who would be interested in this extension would not be interested in an unstable CVS version, so I have only patched 'proper' versions.

If I ever do get CVS access to put my changes into the source tree, how do I apply the diff patch (created previously) to what is in CVS?

ryandesign

ryandesign

2005-05-25 10:43

reporter   ~0010224

Read the manual page for the "patch" command:

man patch

johnwebbcole

johnwebbcole

2005-05-25 12:10

reporter   ~0010225

I've updated my cvs head sandbox with Davids new version and attached a zip file (mantisbt-time_taken.zip) with a patch and the extra files to this issue.

Here are some of my quick observations...

With $g_time_taken_hours = OFF; it doesn't seem to let you put in hours. For example:

enter 30 goes to 0:30 (h:mm) great
enter 1:30 goes to 0:01 wrong (I assume it's going to 1 minute 30 seconds
enter 1:30:00 and it still is 0:01

set to on, you can enter hours and minutes

enter 30 goes to 30:00 (hh:mm) great
enter 0:30 goes to 0:30 great

And I have to agree with Victor's recommendations at http://tinyurl.com/89ubu but I would still like to see the code put into CVS while its worked on, just to make things easier on keeping the code up to date.

BTW, here are the procedures I used to get David's changes into my CVS HEAD sandbox...

CVS check out the 1.0.0a2 tag into its own sandbox
Download Davids tarball
Use WinMerge to move changes to the 1.0.0a2 sandbox (I could have copied the entire sandbox, but I like seeing what changed)
Merge the changes from HEAD to the 1.0.0a2 sandbox
CVS check out the CVS HEAD to its own sandbox
Use WinMerge to move changed and new files from the merged 1.0.0a2 sandbox to the CVS HEAD sandbox

I'm sure there are better ways of doing this, but this works for me.

davidnewcomb

davidnewcomb

2005-05-25 12:47

reporter   ~0010226

John,
Already the bug reports are coming in ;)
The time insertion is clearly a bug, which I'll take a look.
Thanks.

oernii

oernii

2005-05-25 14:45

reporter   ~0010227

Just another suggestion:

  • a total sum if partial times per bug could be made
  • a total sum of selected bugs could be made (filter, ID enumeration per select box, ...)

anyway, I love this patch, will it make into 1.0.0 ?

davidnewcomb

davidnewcomb

2005-05-25 19:09

reporter   ~0010238

Thanks for the extra suggestions, I'm gathering them for my next release.
I'm trying to get it in the main source. I'm in discussion with the project leader. Our leader has set up a blog for "should mantis support time tracking".
Please add any (support) comments to it:

http://www.futureware.biz/blog/index.php?title=should_mantis_support_time_tracking&more=1&c=1&tb=1&pb=1

The more people that want it in, the better.

guideweb

guideweb

2005-05-26 11:41

reporter   ~0010247

We should be able to enter time in few formats....

3min
1,5h
1.5h
1h22
1day
1week
1month
1day 4h and 23min

guideweb

guideweb

2005-05-26 11:47

reporter   ~0010248

In the bugnote statitics From should be by default the bug creation and To the current date

grangeway

grangeway

2005-05-26 16:43

reporter   ~0010256

"anyway, I love this patch, will it make into 1.0.0 ? "

1.0 is pretty much 'feature complete' as far as the core developers are concerned. The current plan is to release either 1.0a3 or 1.0RC this weekend. Therefore, any time tracking functionality will not make it into the final 1.0 release.

Whether time tracking support is included or in what way can be considered for the 1.1 release.

polzin

polzin

2005-05-26 17:20

reporter   ~0010257

@ 0004428:0010247:
I believe the simple time input is better.

@ 0004428:0010256: Not in 1.0.
This is bad luck, since johnwebbcole has been asking for feedback for months now. I would als like to see it in the next version, even if it´s "off by default". Of course I see the problem that it still can cause trouble. And getting 1.0 ready is also an important goal.

davidnewcomb

davidnewcomb

2005-05-27 13:01

reporter   ~0010263

Last edited: 2005-05-27 13:21

0004428:0010247
I think you are dreaming! That is a parsing project in itself, besides, what if you are not english!

0004428:0010248
This is what is by default. Although for the purposes of billing maybe it would be better to have it from the start of the month. We could have a couple of options, selected by a global. start_of_bug, start_of_month, start_of_week, anything else?

seweso

seweso

2005-06-01 05:33

reporter   ~0010313

I added a time-tracking utility which could help you register the time spend per bug. Just add the user_time.php to your mantis directory and create an extra table (create-table and other info is in the php file).

See single_file_time_tracker.zip.

ralfiii

ralfiii

2005-06-02 04:58

reporter   ~0010328

I haven't looked into the patches provided so far, but I'd like to mention a good guide of what to measure:
http://www.joelonsoftware.com/articles/fog0000000245.html
(I got the link from the discussion on 0004968 )

ralfiii

ralfiii

2005-06-02 05:52

reporter   ~0010330

To save you from reading that (though the JoelOnSoftware-doc is clearly woth having a look):

Fields should be:

  • OrigEst (Original estimated time needed to implement)
  • CurrEst (Current estimation)
  • Elapsed

When a bug is closed CurrEst and Elapsed should be equal.

davidnewcomb

davidnewcomb

2005-06-02 08:10

reporter   ~0010333

Just read all of Joe's document and 0004968 plus relating. While it would be useful, to some, it is beyond the scope of this Time Tracking extension. You are getting into the realms of project management.

This time tracker is to calculate the 'actual' time spent on writing the bugnote and the work that 'actually' took place in order to write the bugnote. It is not concerned with estimates as they are not billable.

0004968 sounds like all the developers will add a bugnote with an estimated time and then update their bugnotes' as they do their work. Eventually all the developers will finish their tasks and actual can be compared to estimated. You are trying to shoehorn mantis to be a project manager/planner which it is not.

I agree with 0004968:0008593; most of what you want can be achived using custom fields. I think that estimates forcasting should remain on 0004968 or remain in the project manager software.

johnwebbcole

johnwebbcole

2005-06-02 09:21

reporter   ~0010335

I agree with David, simpler is better, especially since this feature isn't in CVS yet. Most of the project management stuff can be done with custom fields and the suggestion in 0005055 would make that very easy to accomplish. It can feature creep after its in the source tree.

The only feature I'd like to add is a javascript stopwatch to fill the form out for use by CSRs to time phone calls and such, but that isn't as important as getting it in mantis (you can google on 'javascript stopwatch' and see several examples).

I'm for getting as many of Victor's suggestions in as possible and get it in CVS. I'm running this in production right now and can't give it up, so until it's in CVS, I have to maintain a couple of versions to keep things up to date. Getting this in CVS, even default off and marked experimental would simplify my Mantis life.

davidnewcomb

davidnewcomb

2005-06-02 12:40

reporter   ~0010339

I'll take a look at the stopwatch but the trouble is that there are lots of places where the 'Add Bugnote' forms appear. It would be really nice if there was just one add_bugnote function (with lots of parameters), which handled printing the form. If it was centralised it would save loads of time, but unfortunately the Add bugnote form has been re-written in about 5 different places.

ralfiii

ralfiii

2005-06-06 10:26

reporter   ~0010370

I am not sure which direction this bug is going.
Reading about the stopwatch I get the impression, some would like to record, how much time was spent writing a bugnote?!? (isn't this a total useless info?)

However, I implemented a really small adaption to 1.0.0a2, so time-tracking abilities as described in the JoelOnSoftware-guide are added to Mantis.

Anyone interested?

davidnewcomb

davidnewcomb

2005-06-06 13:07

reporter   ~0010374

My intension is to track billable time. If some one phones and ties you up for 20 minutes then that is billable time. I guess John Cole is using it for that.

I however, use it to track how much time I spend on a particular update. For example my bugnote would be "I updated the images page" and my time taken would be 3 hours. I add all the related emails (theirs and mine) on those occasions I make the time taken equal to thinking time, research time and email writting time. Now I can keep track of all the time costs spent on a particular enhancement and easily split it up into monthly chunks.

Don't get me wrong, I liked JoelOnSoftware-guide approach, but my point is that almost all of that can be implemented using custom fields. Where as bugnote updates can not.

grangeway

grangeway

2005-06-06 17:27

reporter   ~0010376

"almost all of that can be implemented using custom fields. Where as bugnote updates can not."

As you mention this, one of the things i've been looking at seeing if it's feasible is to extend custom field support to other objects, e.g. bugnotes/users. Locally, I've pretty much got working code to do this in all but the admin interface (and a cleanup).

ralfii: do you also have a patch to go with those screenshots somewhere? ( to an extent, that looks 'a bit like' the progress bar in other bugtrackers, for example: http://flyspray.rocks.cc/bts/ ).

I've been keeping an eye on this issue, when thinking about custom fields for bug notes for a couple of reasons:
a) someone (i.e. victor/myself) could potentially get the job of merging these two patches.
b) it could be interesting to consider if we could use the data entry as a 'special' custom field.
c) there's a number of views about timetracking functionality, that i'm not quite sure where this bug is heading atm.

time-tracking isn't something I could see my regularly using, however, I can see how it could be useful. One of the big things for me that is missing from mantis is a concept of a 'due date'. ETA/Projection don't really cut it for me. A concept of a due date would allow a couple of new reports/summary views, e.g. 'late/slipping issues'.

</endofftopicrant>

johnwebbcole

johnwebbcole

2005-06-06 17:48

reporter   ~0010377

Our developers are using the time tracking feature just like David does, keeping track of how long a feature or bug takes to implement. While we don't bill off of it, it works nicely for this and has already surprised a lot of people to actually put a cost in hours for a simple feature.

Our customer service department uses http://www.helpstar.com/ to manage issues. Since mantis has begun the slow process of expanding beyond bug tracking to issue tracking, it would be great to move our CS department over to Mantis and integrate the two systems. Mantis does everything we use helpstar for, except time tracking, where they do bill customers based on time spent on an issue.

The javascript stopwatch would be a nice feature for us, thinking about it, it really doesn't merit inclusion except as a nifty gizmo. But it would be perfect for our CS people.

ralfiii

ralfiii

2005-06-07 03:31

reporter   ~0010380

Grangeway, I attached the patch agains 100a2.

Unfortunately php is new to me, otherwise I would have made the effort-fields a float. But in gpc_api there were no routines handling floats, only gpc_get_int, so I sticked with int for the moment.

hennot

hennot

2005-06-09 05:12

reporter   ~0010443

Here is a screenshot of how time estimates are (quite nicely) solved in FogBugz: http://www.fogcreek.com/FogBugz/40tour/11.html I havent used FogBugz myself and I don't know if those values are used in any statistics.

What are the reasons of not getting into the realms of project management? In my opinion, since we have projects already, this would just improve

You are trying to shoehorn mantis to be a project manager/planner which it is not.

I have been managing projects with mantis for some time. There is Manage | Manage Projects section in Mantis, which allows you to do just that - manage projects. We are just improving on this.

ETA/Projection don't really cut it for me
Ditto. It would, if it was a calculated field (from current estimations)

davidnewcomb

davidnewcomb

2005-06-09 05:34

reporter   ~0010446

There is Manage | Manage Projects section in Mantis, which allows you to do just that - manage projects. We are just improving on this.

With respect, the 'Managing Projects' does not manage projects. It is merely a better name for Add/Modify/Delete Projects. There is more to managing a project than assigning people to it! What about time managing, project dependancies (this waiting on that etc), assigning resources, writing documentation, interfaces, billing - where does it end?

Writing all this is a massive undertaking. I don't think Mantis could take this kind of evasive change so early in its development. Maybe a SquirrelMail pluggin archtecture is needed?

ralfiii

ralfiii

2005-06-09 05:46

reporter   ~0010448

...but we are not talking about all these features, we are talking about this tiny little extension "time tracking".
It can be implemented easily (it's actually only a few lines of code), and it perfectly makes sense.

And if you don't like it at all, you could - also very easy - make it an option that could be disabled on installations where not needed.

hennot

hennot

2005-06-09 16:22

reporter   ~0010458

I agree with Ralf. You don't need all that functionality. But time tracking makes sense because times are attached to a comment which explains how that amount of time was spent and possibly why exactly another x time units are needed to accomplish the task.

davidnewcomb

davidnewcomb

2005-06-10 05:56

reporter   ~0010470

Ralfiii when you talk about 'this tiny little extension "time tracking"' are you talking about my time tracker or your time tracker?
If it is mime, then 0004428:0010217 mentions that there is a option to turn it off.
If it is yours, then I thought this bugnote was talking about my patch.

My comments (0004428:0010446) we meant to be rhetorical and were a response to 'What are the reasons of not getting into the realms of project management?' I was trying to explain than other non-related enhancements were starting to creep in and distract from my original idea.

I think all those people who want estimated time for projects should add their comments to 0005055, and all those who want bugnote basic time tracking stay here.

I am trying to present my solution for time tracking but it is being polluted with 'extras'. There is a lot of discussion about what people want from estimated time. This should be discussed in 0005055 as that bugnote is solely aimed at estimated time projections. Although they are kind of related, there is no reason why they can't be implemented independently and added at different stages.

My enhancement is already being used in 2 production environments (mine & johnwebbcole's). How many other companies are out there who have similar working practices?

hennot

hennot

2005-06-10 06:00

reporter   ~0010471

i'm using your extension, david

stevemagruder

stevemagruder

2005-06-10 12:13

reporter   ~0010477

I'm still interested in this issue, but yesterday I stopped monitoring it. However, today, I'm still getting emails as if I'm monitoring it. Is this a bug?

vboctor

vboctor

2005-06-10 12:37

manager   ~0010479

stevemagruder, you will get notifications in the following cases:

  • If you are the reporter.
  • If you are the handler.
  • If you are monitoring the issue.
  • If you are the author of issue notes (which you are).

So there is no way, to disable notifications on a per issue basis, if you have authored a note. If you want, you can report an enhancement request.

Loki

Loki

2005-06-10 12:37

reporter   ~0010480

I'm about to put Mantis 1.0.0a3 into production. I very much want this patch in Mantis 1.0.0. I like it basically like it is. Add a note and be able to say how much time it took to do the work on the issue. David does your patch work with 1.0.0a3?

davidnewcomb

davidnewcomb

2005-06-12 20:08

reporter   ~0010491

Loki: I was waiting for the final stable release of 1.0.0 before bringing my patch forward. I don't do it for every release - its too time consuming! You could take the diffs (provided my johnwebbcole) and try applying them.

Any one know when the final release of 1.0.0 is coming out?

stevemagruder

stevemagruder

2005-06-13 21:48

reporter   ~0010499

Couldn't we go ahead and have this patched into CVS now so that those of us who are keeping up with CVS updates can test the feature as much as possible before 1.0.0 is final? (By the way, I'm now working with the CVS version and am no longer stuck on 0.19.2 :) )

ralfiii

ralfiii

2005-06-14 03:43

reporter   ~0010501

Last edited: 2005-06-14 03:54

@DavidNewcomb, 0004428:0010470 : I was talking about "my" time tracker (tracking Original, Current Estimation and Elapsed time).

Rather than 0005055 I'll move my comments back to 0004968.
However, I'll post a comment to 0005055

Btw: What exactly are you planning to track in "your" extension.

davidnewcomb

davidnewcomb

2005-06-14 05:42

reporter   ~0010506

Basically, a how long did you spend on this bug action.
0004428:0010333: "This time tracker is to calculate the 'actual' time spent on writing the bugnote and the work that 'actually' took place in order to write the bugnote. It is not concerned with estimates as they are not billable."
0004428:0010374: "time I spent on a particular update"

oernii

oernii

2005-06-14 08:39

reporter   ~0010509

to ralfiii:

is TimeTrackingPatch_100a2.zip supposed to work against 1.0.0a2 ? because I just unpacked mantis-1.0.0a2 and ran that patch agains it and got this:

$ patch < TimeTrack.patch
patching file bug_update.php
Hunk 0000001 FAILED at 60.
1 out of 1 hunk FAILED -- saving rejects to file bug_update.php.rej
patching file bug_update_page.php
Hunk 0000001 FAILED at 280.
1 out of 1 hunk FAILED -- saving rejects to file bug_update_page.php.rej
patching file bug_view_advanced_page.php
Hunk 0000001 FAILED at 373.
1 out of 1 hunk FAILED -- saving rejects to file bug_view_advanced_page.php.rej
patching file bug_view_page.php
Hunk 0000001 FAILED at 279.
1 out of 1 hunk FAILED -- saving rejects to file bug_view_page.php.rej
can't find file to patch at input line 130
Perhaps you should have used the -p or --strip option?
The text leading up to this was:

|Index: core/bug_api.php
|===================================================================
|RCS file: /cvsroot/mantisbt/mantisbt/core/bug_api.php,v
|retrieving revision 1.93
|diff -u -r1.93 bug_api.php
|--- core/bug_api.php 11 Apr 2005 17:05:47 -0000 1.93
|+++ core/bug_api.php 3 Jun 2005 13:27:40 -0000

File to patch:

ralfiii

ralfiii

2005-06-14 09:05

reporter   ~0010510

Oerni: I am no expert regarding CVS but I suppose instead of using the "normal" installer you should get the mantis-folder via CVS, get the files tagged "RELEASE_1_0_0a2_20050425" and then patch it.

I've just uploaded the files that were changed in V1.0.0a2 to bug 0004968
It should be possible to simply copy those files into your existing Mantis installation.

Let me know if you have further problems.

zecty

zecty

2005-07-22 17:16

reporter   ~0010929

Reminder sent to: zecty

jaapandre

jaapandre

2005-09-20 10:58

reporter   ~0011402

Unfortunately this bugnote ended somewhere in june, in the meantime the second release candidate has been released and I cannot found any update about time tracking. For us it would be very usefull, if it is possible to register the time every time we add a note, using a custom fields is not a very usefull solution, it is easily forgotten and mistakes can easily made.

davidnewcomb

davidnewcomb

2005-09-21 09:22

reporter   ~0011419

Sorry, but this thread did not end it June - it just went quite!
1.0.0a1, 1.0.0a2, 1.0.0a3, 1.0.0rc1 1.0.0rc2, etc and all just patches for a pre-release of 1.0.0.
In bugnote @10480 I said I would wait until the final release of 1.0.0 before making another release.

johnwebbcole

johnwebbcole

2006-01-10 09:50

reporter   ~0011897

David,
Have you made any improvements to the time tracker and reports? If so, I'll be happy to give them a try. I'm planning on putting my modifications into the next rc when it comes out (and it passes my tests :-) )

John

davidnewcomb

davidnewcomb

2006-01-12 05:27

reporter   ~0011916

Thanks John. Jeroen has given me access to update the CVS myself. I will start work on adding Time Tracking to Mantis. I will be reviewing the comments that people have made. So watch this space!

jmjosset

jmjosset

2006-01-12 16:04

reporter   ~0011928

Reminder sent to: jmjosset

Merci de traiter le bug rapidement

ionutj

ionutj

2006-05-23 03:08

reporter   ~0012890

Hi all,

Is very usefull this "time taken" patch, how can I integrate in mantis 1.0.3 or 1.0.1 ?...thank you ..very much ..how can help me..

Best regards
Ionutj

davidnewcomb

davidnewcomb

2006-06-08 06:02

reporter   ~0012946

I have collated all the related information from this bugnote, related bugnotes and the blog, and will begin in ernst.

vboctor

vboctor

2006-09-15 03:09

manager   ~0013392

Does someone have the attachments for this issue? If so, please upload. The original attachments were lost.

davidnewcomb

davidnewcomb

2006-09-25 04:57

reporter   ~0013489

I only have my full verion. Which I have uploaded.

ralfiii

ralfiii

2006-09-25 05:04

reporter   ~0013490

I could produce the diff-files and screenshots again (against Mantis V1.0.5) but I think this bug is more about the "time taken" functionality and "my" implementation is actually covered by bug 0004968, so if requested I would upload it there...

johnwebbcole

johnwebbcole

2006-09-25 09:14

reporter   ~0013501

Has this been put into the 1.1 version yet, or do I still need to diff it in?

Thanks,

John

vboctor

vboctor

2006-09-27 00:13

manager   ~0013518

This is not yet integrated into Mantis releases. Once it is integrated the issue will be resolved.

RyanR

RyanR

2006-10-11 15:06

reporter   ~0013608

Would it be possible to include Ralfiii's expense tracking patch as well? It looks like it was available for 1.0.0 but the attachment is now gone. Time tracking and cost tracking are very complementary and should fulfill most project managment needs.

RyanR

RyanR

2006-12-08 13:22

reporter   ~0013789

Does anyone have a version 1.1.0 based patch for this feature?

davidnewcomb

davidnewcomb

2006-12-12 14:19

reporter   ~0013809

Last edited: 2006-12-12 14:24

I have checked in my first set of code. I have added all my options to the bottom of config_defaults_inc.php.
I have implemented some of the features discussed here and in the blog.
johnwebbcole - I even added a nifty stop watch feature just for you ;)

All comments will be gratefully received.

vboctor

vboctor

2006-12-15 02:13

manager   ~0013831

Last edited: 2007-02-24 00:43

I did a quick review of the checked in functionality and following are my comments:

  • We should create a Wiki page for this feature that explains the supported functionality. Please use the Wiki page associated with this issue.
  • Store the time in the database as an integer with minutes as the unit.
  • Add a step to the schema that adds the required field.
  • Make sure the code uses ADODB rather than MySQL specific code.
  • Avoid use the term "Bugnotes". Use Time Tracking Report, etc.
  • Date format hard-coded to American format. Use same technique as in the filters.
  • In the time tracking report, I would add a row per time entry which has the date, user name, duration, and a truncated part of the note. The number of characters to display can be controlled by a config variable (0-all, otherwise truncate after N chars, but default set to 0). Use valign=top so that text is aligned at the top for entries which have wrapping notes.
  • We should support csv export of the above report, specially when it is triggered from the billing_page.php.
  • Add an empty line between the Bugnote statistics date range box and the actual report result.
  • The link to the billing page is not shown if the $g_time_tracking_with_billing is set to OFF. However, the page can be visited directly and works but hides the cost / hour. We should probably keep the link as long as $g_time_tracking_enabled is set to ON.
  • I am not sure of the value from supporting the cost. For this to be useful, I think we need to support a default rate per user, then have the ability to override this per project. The same way we handle access levels.
  • Issue Ids in the billing page should be hyper linked.
  • Shouldn't the dates in the billing page be defaulted the same way the date range is defaulted in the view issue page.
  • Add $g_time_tracking_edit_threshold to control the access level required for a user to be able to add/edit time. This should be defaulted to DEVELOPER.
  • Add $g_time_tracking_reporting_threshold that sets the access level required to run a report on the time tracking information. If this is OFF, then the billing page should not be accessible (access denied) and the link shouldn't be in the menu.
  • Add $g_time_tracking_view_threshold that sets the access level required to view bug notes that having time information associated with them. A user who has edit threshold must have view threshold.
  • The way the time is displayed is not clear, we should think of a way to display it in bigger font and in a more obvious place.
  • Do we want to support the case where a user enters a time but no note text? In this case we should probably format it differently.
  • The currency symbol is hard coded.
  • If there are no entries matching the project and date range, then nothing happens. We should output a message indicating that there are no matching entries.
  • In billing_inc.php, would $PHP_SELF be defined in register globals is OFF?
  • In billing_inc.php, if this is part of the view issue page, then we should get the project id from the issue, if it is the billing page, then we should get the project id from the current project. You can set this variable before including the billing_inc page.
  • In the billing_page report, I would probably leave a blank line between issues and would probably have the issue number / summary with a white background.
  • In the documentation for $g_time_tracking_stopwatch clarify the dependency on $g_use_javascript and that the javascript needs to be enabled in the browser.
davidnewcomb

davidnewcomb

2006-12-17 08:25

reporter   ~0013837

All useful comments. I'll get to work on them. I don't appear to have the right permissions to set up a wiki entry so can someone do that for me so I can start on some documentation.

vboctor

vboctor

2006-12-17 17:19

manager   ~0013838

David, I granted you the developer access and assigned this issue to you. This should also allow you to create the wiki page associated with this issue. Just click the Wiki link at the top of this page and then click Create Page.

vboctor

vboctor

2006-12-26 05:59

manager   ~0013864

Just an update for the progress with this issue:

  • David did the following:
    • Changed the type of the time to an integer.
    • Added a schema upgrade step to add the integer field.
    • Created a wiki page.
  • I've implemented the following:
    1. Add TIME_TRACKING as a bug note type. Similar to REMINDER.
    2. If the note was empty, the time was ignored and no error message was prompted. For now, we add the note with an empty comment, no email is sent, but the note is added.
    3. One of the db_* APIs was still referring to a $t_sec variable.
    4. The stop watch was using hh:mm:ss format which was considered invalid by the API. Now the seconds are used to come up with an approximated minute.
    5. Removed the "bugnote" strings and used "time tracking" instead.
    6. Improved the formatting to make the duration more prominant.
    7. Optimized the API that converts a number of minutes to hh:mm format.
    8. Added "Total time for issue" at the end of the notes section.
    9. Removed the pound sign that was hard-coded on the billing page.
seiji

seiji

2006-12-26 06:41

reporter   ~0013865

In bugnote_stats_inc.php 65L,73L), lang_get('from') and lang_get('to') are used for I18N.
But they($s_from, $s_to) are already used in bug_reminder_page.php and mean e-mail address not time.
Please change them to other strings.

Sorry for my poor English.

davidnewcomb

davidnewcomb

2006-12-29 14:38

reporter   ~0013875

0004428:0013865: Done.
0004428:0013831: I have added and linked in g_time_tracking_edit_threshold and g_time_tracking_view_threshold.

Wiki updated with the new configuration options.

seiji

seiji

2007-01-05 04:27

reporter   ~0013897

Thanks, davidnewcomb.
but please correct as follows too.

  • billing_inc.php 69line and 77line.
davidnewcomb

davidnewcomb

2007-01-07 06:40

reporter   ~0013901

0004428:0013897: I had left this one because I knew I would have to fix the date entry form stuff, but I have now changed it as an interim.

daryn

daryn

2007-02-16 13:44

reporter   ~0014056

My company is migrating to Mantis. We would like to assign hours to a category of work such as analysis, development, testing, etc. It seems that the bugnote type could be extended to achieve this functionality by allowing the user to select the note type from a configurable list. This would enhance reporting by enabling us to easily track how much time is being spent in the various categories by user and across the organization.

Is this something others might find useful and in keeping with the bug tracking focus? I would be willing to help develop this in any way that I can. I have PHP experience but am new to Mantis.

davidnewcomb

davidnewcomb

2007-02-20 12:49

reporter   ~0014075

Apologies for the tardy reply. What you are suggesting can be achieved using the current model in the same way that they use it at mantis to do a whole release (0005410). Basically, create a bug report "Add feature x", then add a children bug reports called "analysis new feature x", "develop feature x" and "test feature x".

I would just have to make the top level parent sum the total times of all the child bugnotes to produce an overall time.

vboctor

vboctor

2007-02-24 00:53

manager   ~0014091

davidnewcomb, I would like to resolve this bug to represent that the initial version of this feature is complete. Can you please add a note identifying the work done from the list in 0004428:0013831 and also the status of the issues raised in the notes after it.

What I think we should do is:

  • Update the bug with the status of all the issues remaining.
  • The must have ones should ideally be done before we resolve the bug.
  • Others should be reported as separate bugs and tracked separately.
  • Verify that the Wiki documentation is up to date with the current implementation.
daryn

daryn

2007-03-05 10:32

reporter   ~0014130

davidnewcomb,

Thanks for your reply. Sorry this response is so late. I've been away from the office.

I see that your suggestion would technically work. I disagree however that it would be a useful solution. Using a heirarchical model for a big project with subcomponents is great, but to break down each little piece into sub issues based on the category of work would quickly become a project manager's nightmare.

For instance, let's say I have a product that I have released to a client for testing. They find 100 bugs. Some of them small typos, some of them larger system issues...it doesn't matter what the bug. Under your suggestion I would have to open an additional x number of bugs for each one just to be able to categorize the hours. In our case, x could be 1-10 categories. Let's average and say that we have five categories for each bug. I suddenly have 600 bugs to deal with rather than 100. The original 100 parent bugs plus the 5 for each category of each bug. There is no way my project managers are going to be ok with this solution and I can't imagine that others would be either.

My company requires that we be able to break down the time spent on a project by the hours spent in each category. The basic structure for my suggested solution is already in place.

We would need to:

  1. add the note type as a drop down list, defaulting to a regular bugnote if nothing is selected, validate selection.
    1. Allow the note type drop down to be turned on and off via configuration
  2. Make the values for the list configurable
  3. The most complicated part, create or expand the reporting to account for the categories in individual issues or groups (parent/child) of issues. And be able to calculate times by user as well.

It makes sense to keep all the time tracking for one issue in that issue, regardless of the type of work. Whether it's analysis, development, testing or whatever, it's still the same issue and would be much more easily managed as one issue.

I would like to see this make it into Mantis because I believe it is a better solution and provides a nice balance of adding a more complete time tracking/reporting function without stepping too far into project management.

As I said before, I am willing to code this and contribute it but I need to know whether you accept the concept before I start working on it. I look forward to your response.

Kind Regards,

Daryn

jim_thurrock

jim_thurrock

2007-03-08 08:33

reporter   ~0014138

There is a thread on the board about adding time tracking:
http://www.mantisbt.org/forums//viewtopic.php?t=589&postdays=0&postorder=asc&start=36

A lot of people seem interested.

Is time tracking support already in CVS, or does is it have a planned for a later version? (I couldn't find it on the road map)

vboctor

vboctor

2007-03-08 09:26

manager   ~0014139

The implementation of this feature is now in CVS and will be included in 1.1.0a3. I have updated the target release so that this issue appears on the roadmap.

jim_thurrock

jim_thurrock

2007-03-08 09:32

reporter   ~0014140

Great! Thanks :) The release looks almost ready. Any rough ETA? (a week, a month?)

dwheet

dwheet

2007-03-14 22:40

reporter   ~0014182

I noticed when doing my reports that time spent doesn't show up. I'm currently using the CVS code. Since I'm going to use this for ticketing for my customers it would be nice to generate a report to know how many hours my employee's worked on said project so I can then bill them for it. I would also like it to be specific per project. so if I spent 2 hours on a ticket in Project A and 2 hours on a ticket in Project B it doesn't lump them together and say I worked 4 hours. If thats possible.

rzg

rzg

2007-03-22 11:21

reporter   ~0014230

Is this supposedly complete? I'm using CVS; If I turn it on, I get fun SQL syntax errors like:
"APPLICATION ERROR 0000401

Database query failed. Error received from database was 0008120: Column 'u.username' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause. for the query: SELECT username, SUM(time_tracking) sum_time_tracking
FROM mantis_user_table u, mantis_bugnote_table bn
WHERE u.id = bn.reporter_id AND
bn.bug_id = '14503'
AND bn.date_submitted > '2007-0322' AND bn.date_submitted < '2007-0322'
GROUP BY u.id"

vboctor

vboctor

2007-04-22 02:55

manager   ~0014383

I've just committed fixes to a lot of issues relating to this issue. This is including the bug mentioned by "rzg". This bug was due to a bug in db_prepare_date(). There were also a lot of bugs when notices are turned ON.

I will resolve this issue now. If there are any issues that are not yet covered which are mentioned here or not yet found, please report a separate bug for it.

Related Changesets

MantisBT: master fe2bc7bc

2006-12-12 13:26

davidnewcomb


Details Diff
Add time tracking functionality see bug 4428

git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/trunk@4246 <a class="text" href="/?p=mantisbt.git;a=object;h=f5dc347c">f5dc347c</a>-c33d-0410-90a0-b07cc1902cb9
Affected Issues
0004428
mod - bug_view_page.php Diff File
mod - core/database_api.php Diff File
mod - config_inc.php.sample Diff File
mod - bug_update_advanced_page.php Diff File
mod - bugnote_add_inc.php Diff File
mod - core/custom_function_api.php Diff File
mod - bugnote_update.php Diff File
mod - bugnote_add.php Diff File
mod - bugnote_view_inc.php Diff File
add - core/bugnote_stats_api.php Diff File
add - billing_page.php Diff File
mod - config_defaults_inc.php Diff File
mod - javascript/common.js Diff File
mod - bug_change_status_page.php Diff File
add - billing_inc.php Diff File
add - bugnote_stats_inc.php Diff File
mod - lang/strings_english.txt Diff File
mod - core/html_api.php Diff File
mod - core/bug_api.php Diff File
mod - bugnote_edit_page.php Diff File
mod - bug_update.php Diff File
mod - bug_update_page.php Diff File
mod - print_all_bug_options_inc.php Diff File
mod - admin/schema.php Diff File
mod - bug_reminder.php Diff File
mod - core/bugnote_api.php Diff File
add - javascript/time_tracking_stopwatch.js Diff File