? 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 @@
+
+
+
>
+ |
+
+ |
+
+
+ |
+
+
+
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 @@
+
+
+>
+ |
+
+ |
+
+
+ |
+
+
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 @@
+
+ |
+
+ |
+
+
+ |
+
|
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 @@
|
+
+
+ (HH:MM)
+
+ |
+
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 @@
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 @@
+
'.lang_get( 'edited_on').' '.$v3_last_modified.' ';
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++;
?>
-
- |
+
+ |
";
}
$bugnote_index++; ?>
+
+
+ |
+ ";
+ }
+ $bugnote_index++; ?>
|
-
+
- |
+ |
|
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[] = '' . lang_get( 'billing_link' ) . '';
# 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 (£)';
+$s_cost = 'Cost';
+
?>