Mantis Add-On - Time Tracker - Easy to run & install

Post about your customizations to share with others.

Moderators: Developer, Contributor

dbyy
Posts: 6
Joined: 30 Jan 2006, 12:29
Location: Sudbury, Ontario, Canada

Timetracking in rc5

Post by dbyy »

Hi,

I installed the time-tracking module to mantis 1.0.0.rc5

I added the following code as mentioned in INSTALL.TXT

>>>
- Add this line to all the bug pages you would like the module to appear (or copy the content):
<tr>
<td class="center" colspan="6">
<?php
// MODIFICATION GAMBIT: Time Tracking
include 'modules/time_tracking/time_tracking.php';
?>
</td>
</tr>

<<<
to the module bug_update_advanced_page.php

But when I load the page (update task) I receive the following message:
>>>
APPLICATION WARNING #100: Configuration option 'username' not found.

APPLICATION WARNING #100: Configuration option 'password' not found.
Missing file: F:\WebShare\mantis-1.0\core\adodb/drivers/adodb-localhost.inc.php

ADONewConnection: Unable to load database driver ''

<<<

Does anyone know a cure for this?

Can someone make a sggestion what the pages are I should add the time-tracking code?

Any help much appreciated.

TIA
dbyy
NormanG

Timetracking with Mantis 1.0.1

Post by NormanG »

Hi,

i just followed both instruction tiabarca and Tobias Meyer made
... works perfect with mantis 1.0.1

But the reports are still missing :(

Can anybody help?
marcg
Posts: 3
Joined: 07 Jan 2006, 19:44

Reports

Post by marcg »

Hi!

Due to popular demand, here is the reports addon to the Reports customization. I have no time to provide documentation.

http://www.ps2on.com/MantisTimeTrackingReports.zip

Please, do no uncompress the files directly on your Mantis directory, check them first and do diffs, specially on core/html_api.php.

Also, the strings I provide are in spanish, so feel free to add the key/value pairs to your language file.

I'd be glad if the original author could integrate it and release it as a full customization.

Also, I made some customizations to the module files, to remove the cost column and to allow access to the data only from DEVELOPER people.

Works currently in 1.0.0.rc4, but should also work with 1.0.0 and 1.0.1.

Hope it helps!
jjrohrer

Anybody interested in working on Outlook integration

Post by jjrohrer »

Hi,
My company is in the middle rolling-out Outlook & exchange. We also use a slightly older and slightly customized version of Mantis. I need a better and more integrated time tracker. The patch mentioned in this post seems like it might be helpful. One leading idea is to use time tracking from within mantis, however, I would still need a more general way of entering time. I'm just brainstorming right now, but if you are interested in the working on the following, then please contact me. I have some money for this project.

Some ideas:

* Have, on an optional per-user basis, mantis times show up in the user's outlook calendar.

* In outlook, have an _easy_ way of designating that block of time is associated with a mantis activity. We use four digit job-codes here. it would be cool if a user could specify their default project/job code so all meetings, etc, that are listed in outlook get recorded into the timesheet datbase. Also, if topic of an appoint started out with a four digit code, then it would sync with that respective mantis project, instead of that user's default project.

* maybe a web-based or outlook based "timesheet" view for rapidly filling in all of the blank spots for the week so that the hours of the day add up to 8 (or whatever). Consider that you can account for maybe 1/2 of your day with meetings, working on specific projects, etc., but maybe your spent the rest of the day running around work on project A & project B, so you want to assign 4 hrs of time to project A and another 4 hours to project B, but not really assigned to specific times of the day.

* a stop-watch

* a list of favorite projects

* Should this tie in with microsoft project? We don't use it now, but some employees are asking for it.

Thanks,
JJ
contact me at: jrohrer at sterling research group dought com
Brokit
Posts: 7
Joined: 08 Mar 2005, 09:27

Post by Brokit »

Hi Folks.

There I did not reply to this topic but to be honest, I simply forgot about the topic. But that I have a new problem to solve I come creeping back to the forum looking for input on translateable and project based custom field values. Again it seems like I have to find the solution myself.

I am glad, so many of you liked to use the tim tracker module. With the current mantis version our top priority was an easy upgrade path to new mantis releases so I developed a version that only uses custom fields and custom_function files. By the way, there should be a minimal fix to the mantis codebase because the event handler for custom functions in bug_update.php is in the wrong place. It should move from

...
# Handle auto-assigning
if ( ( NEW_ == $t_bug_data->status )
&& ( 0 != $t_bug_data->handler_id )
&& ( ON == config_get( 'auto_set_status_to_assigned' ) ) ) {
$t_bug_data->status = config_get( 'bug_assigned_status' );
}

# helper_call_custom_function( 'issue_update_validate', array( $f_bug_id, $t_bug_data, $f_bugnote_text ) );

$t_resolved = config_get( 'bug_resolved_status_threshold' );

$t_custom_status_label = "update"; # default info to check
if ( $t_bug_data->status == $t_resolved ) {
$t_custom_status_label = "resolved";
...

to:

...
// update bug data with fields that may be updated inside bug_resolve(), otherwise changes will be overwritten
// in bug_update() call below.
$t_bug_data->status = bug_get_field( $f_bug_id, 'status' );
$t_bug_data->resolution = bug_get_field( $f_bug_id, 'resolution' );
break;
} # else fall through to default
}
}

helper_call_custom_function( 'issue_update_validate', array( $f_bug_id, $t_bug_data, $f_bugnote_text ) );

# 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 );
}

Because the function is called before custom fields are parsed in the original version you will not be able to access the values in the custom_function file.

Best regards,
Elmar
cas
Posts: 1586
Joined: 11 Mar 2006, 16:08
Contact:

Added a small option for this

Post by cas »

Our users found it difficult to control their hours since there was not a full overview for them.
Hence i modified one of the scripts such that the logged on person can see what they have booked. This script is available in the menu only for logged on users.
The code for what i called "print_mytime_tracking_page.php" :

Code: Select all

<?php
  require_once( 'core.php' );

  $t_core_path = config_get( 'core_path' );

  require_once( $t_core_path.'current_user_api.php' );
  require_once( $t_core_path.'bug_api.php' );
  require_once( $t_core_path.'date_api.php' );
  require_once( $t_core_path.'icon_api.php' );
  require_once( $t_core_path.'string_api.php' );
  require_once( $t_core_path.'columns_api.php' );
  
  auth_ensure_user_authenticated();
  $t_cookie_value_id = gpc_get_cookie( config_get( 'view_all_cookie' ), '' );
  $t_cookie_value = filter_db_get_filter( $t_cookie_value_id );
  
?>
<?php html_page_top1( lang_get( 'summary_link' ) ) ?>
<?php html_page_top2() ?>

<br />

<?php
$t_project_id       = 0;
$informer=auth_get_current_user_id();
$day_from = $_REQUEST['day_from'];
$month_from = $_REQUEST['month_from'];
$year_from = $_REQUEST['year_from'];
$day_to = $_REQUEST['day_to'];
$month_to = $_REQUEST['month_to'];
$year_to = $_REQUEST['year_to'];

if ( ! is_blank( $t_cookie_value ) ) {

    # check to see if new cookie is needed
    if ( ! filter_is_cookie_valid() ) {
      print_header_redirect( 'view_all_set.php?type=0&print=1' );
    }

    $t_setting_arr = explode( '#', $t_cookie_value, 2 );
    $t_filter_cookie_arr = unserialize( $t_setting_arr[1] );

    $f_highlight_changed  = $t_filter_cookie_arr['highlight_changed'];
    $f_sort         = $t_filter_cookie_arr['sort'];
    $f_dir          = $t_filter_cookie_arr['dir'];
    $t_project_id       = helper_get_current_project( );
  }
?>
<form method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<table class="width100" cellpadding="2px">
<?php 

$t_icon_path = config_get( 'icon_path' );

?>

<tr>
  <td>
<?php
    if ( 'DESC' == $f_dir ) {
      $t_new_dir = 'ASC';
    } else {
      $t_new_dir = 'DESC';
    }

    $t_search = urlencode( $f_search );

    $t_icons = array(
      array( 'print_time_tracking_page_excel', 'excel', '', 'excelicon.gif', 'Excel 2000' ) );

    foreach ( $t_icons as $t_icon ) {
      echo '<a href="' . $t_icon[0] . '.php' .
        "?informer=$informer" .
        "&day_from=$day_from" .
        "&month_from=$month_from" .
        "&year_from=$year_from" .
        "&day_to=$day_to" .
        "&month_to=$month_to" .
        "&year_to=$year_to" .
        '" ' . $t_icon[2] . '>' .
        '<img src="' . $t_icon_path . $t_icon[3] . '" border="0" align="absmiddle" alt="' . $t_icon[4] . '"></a> ';
    }
?>
  </td>
  <td>&nbsp;&nbsp;&nbsp;&nbsp;
    <?php echo lang_get( 'print_time_tracking_from' ) ?>
    <?php 
      $current_date = explode ("-", date("Y-m-d"));
    ?>
    <select tabindex="5" name="day_from"><option value="0">-</option>
      <?php print_day_option_list( $current_date[2] ) ?>
    </select>
    <select tabindex="6" name="month_from"><option value="0">-</option>
      <?php print_month_option_list( $current_date[1] ) ?>
    </select>
    <select tabindex="7" name="year_from"><option value="0">-</option>
      <?php print_year_option_list( $current_date[0] ) ?>
    </select>
    &nbsp;&nbsp;
    <?php echo lang_get( 'print_time_tracking_to' ) ?>
    <select tabindex="5" name="day_to"><option value="0">-</option>
      <?php print_day_option_list( $current_date[2] ) ?>
    </select>
    <select tabindex="6" name="month_to"><option value="0">-</option>
      <?php print_month_option_list( $current_date[1] ) ?>
    </select>
    <select tabindex="7" name="year_to"><option value="0">-</option>
      <?php print_year_option_list( $current_date[0] ) ?>
    </select>
    <input type="submit" name="Send" value="<?php echo lang_get( 'print_time_tracking_update' ) ?>" />
  </td>
</tr>
</table>
</form>
<br />

<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<table class="width100" cellspacing="1" cellpadding="2px">
<tr>
  <td class="form-title" colspan="7">
    <?php echo lang_get( 'viewing_bugs_title' ) ?>    
  </td>  
</tr>
<tr class="row-category">
  <td><?php echo lang_get( 'priority' ) ?></td>
  <td><?php echo lang_get( 'id' ) ?></td>
  <td><?php echo lang_get( 'category' ) ?></td>
  <td><?php echo lang_get( 'severity' ) ?></td>
  <td><?php echo lang_get( 'status' ) ?></td>
  <td><?php echo lang_get( 'last_update' ) ?></td>
  <td><?php echo lang_get( 'summary' ) ?></td>
  <td><?php echo lang_get( 'time_user' ); ?></td>
  <td><?php echo lang_get( 'time_information' ); ?></td>
  <td><?php echo lang_get( 'time_expenditure_date' ); ?></td>
  <td><?php echo lang_get( 'time_hours' ); ?></td>
</tr>
<tr>
  <td class="spacer" colspan="9">&nbsp;</td>
</tr>
<?php

// Busquem el resultat
$all_reported_bugs_query="select t.id,b.priority,b.id,b.category,b.severity,b.status,b.last_updated,b.summary,t.user,t.info,t.hours,t.expenditure_date from mantis_module_timetracking t, mantis_bug_table b where t.bugid=b.id ";
if (!empty($informer) && $informer!=0) {
  $all_reported_bugs_query=$all_reported_bugs_query." and t.user=" . $informer;
}
if (!empty($day_from) && !empty($day_to) && !empty($month_from) && !empty($month_to) && !empty($year_from) && !empty($year_to)) {
  $all_reported_bugs_query=$all_reported_bugs_query." and t.expenditure_date between '" . $year_from . "-" . $month_from . "-" . $day_from . "' and '" . $year_to . "-" . $month_to . "-" . $day_to . "'"; 
}
if ($t_project_id!=0) {
  $all_reported_bugs_query=$all_reported_bugs_query . " and b.project_id=".$t_project_id;
} 
$all_reported_bugs_query=$all_reported_bugs_query . " order by t.expenditure_date ";
$result_timerecords = db_query($all_reported_bugs_query);
$num_timerecords = db_num_rows( $result_timerecords );

$total_hours=0;
//echo "$all_reported_bugs_query";
for( $i=0; $i < $num_timerecords; $i++ ) {
    $t_row = db_fetch_array( $result_timerecords );

    # alternate row colors
    $status_color = helper_alternate_colors( $i, '#ffffff', '#dddddd' );
    $total_hours+=$t_row['hours'];    
?>
<tr bgcolor="<?php echo $status_color ?>" border="1">  
  <td><?php echo get_enum_element( 'priority', $t_row["priority"]) ?></td>
  <td><a href="view.php?id=<?php echo $t_row["id"] ?>"><?php echo bug_format_id( $t_row["id"]) ?></a></td>
  <td><?php echo $t_row["category"] ?></td>
  <td><?php echo get_enum_element( 'severity', $t_row["severity"]) ?></td>
  <td><?php echo get_enum_element( 'status', $t_row["status"]) ?></td>
  <td><?php echo print_date( config_get( 'normal_date_format' ),db_unixtimestamp($t_row["last_updated"])) ?></td>
  <td><?php echo $t_row["summary"] ?></td>
  <td><?php echo user_get_name($t_row["user"]) ?></td>
  <td><?php echo $t_row["info"] ?></td>
  <td><?php echo print_date( config_get( 'short_date_format' ),db_unixtimestamp($t_row["expenditure_date"])) ?></td>
  <td align="right"><?php echo number_format($t_row["hours"], 2, ',', '.') ?></td>
</tr>
<?php

} # for_loop */
# alternate row colors
$status_color = helper_alternate_colors( $i, '#ffffff', '#dddddd' );
?>
<tr class="row-category"><td colspan="10" align="right"><b>Total</b></td><td align="right"><?php echo number_format($total_hours,2,',','.') ?></td></tr>
<input type="hidden" name="show_flag" value="1" />
</table>

<br />
</form>
<?php
    html_page_bottom1( __FILE__ );
?>
Hope you can use it.

Cas
marcg
Posts: 3
Joined: 07 Jan 2006, 19:44

New features and reports

Post by marcg »

Hi!

We're using this customization heavily on our company. What we now miss is some extended reporting features like:

1. Show all the activity between dates, for any project / developer / category. Some sort of "compact" report showing dedication of developer per project.
2. Include subprojects support.
3. Filter by resolved or not.
4. Custom field support.
5. Gantt diagram per project.

We also would like to add a couple of fields to the project (estimated time, planned start, planned end, real start, real, end, ...) that could allow us to get some more reporting results.

We will continue to use it and improve it, but before we continue with the reporting improvement, I would like to know if someone has made any progress on this propsals or has any suggestion about the best way to add them.

Of course, we will post here the results.

Apart from that, this has been done by patching Mantis, which in turn affects every upgrade. Anyone has thought of a better way to do this?
davec
Posts: 6
Joined: 04 May 2005, 16:13
Location: San Francisco

Missing file error on 1.0.3

Post by davec »

I went through the install of teh Time Tracker (not the report yet) on 1.0.3 and when I go to my Issue View Simple I get the following error:

APPLICATION WARNING #100: Configuration option 'username' not found.

APPLICATION WARNING #100: Configuration option 'password' not found.

Missing file: /home/vs02053/public_html/test_site/mantis-1.0.3/core/adodb/drivers/adodb-localhost.inc.php

ADONewConnection: Unable to load database driver ''

Fatal error: Call to a member function on a non-object in /home/vs02053/public_html/test_site/mantis-1.0.3/core/database_api.php on line 43

I noticed someone else got this but there was no solution given. Can I have one please :wink:
jmforesite
Posts: 4
Joined: 11 Jul 2006, 20:22

updated time tracking fix?

Post by jmforesite »

Does anyone have a copy of the latest time tracking file "time_tracking.php" that has the Database fixes that will work with RC5 and above? I am getting the DB error and can't seem to get this working on my own.

Thanks
cas
Posts: 1586
Joined: 11 Mar 2006, 16:08
Contact:

Post by cas »

Here we go :

Code: Select all

<?php
	########################################################
	# Mantis Bugtracker Add-On
	#
	#                     Time Tracker
	#
	# by Elmar Schumacher (elmar.schumacher@web.de)
	# GAMBIT Consulting GmbH
	########################################################

	$bug_id = gpc_get_int( 'bug_id' );
	$table = config_get("timetracking_table");
	
# Time record POST
	if( isset($_REQUEST['time_value']) ){
	
		# Current UserID
		$user = auth_get_current_user_id();
		$time_info = db_prepare_string($_REQUEST["time_info"]);
		
		# Work on Time-Entry so we can eval it
		$time_value = $_REQUEST["time_value"];
		$time_value = strtr( $time_value, ",", ".");
		$time_value = doubleval($time_value);
		
		$time_unit = $_REQUEST["time_unit"];
		
		# Trigger in case of non-evaluable entry
		if ( $time_value == 0 ) {
			trigger_error( lang_get( 'time_value_error' ), ERROR );
		}
		
		# Converting mandays into hours for unified database values
		if($_REQUEST["time_unit"] == "md"){
			$time_value = $time_value * config_get('consultant_manday_definition');
		}
		
		# For record-keeping we also calc the costs according to the hourly charges 
		$costs = $time_value * config_get('consultant_hourly_charge');
		
		# Write Post-Data to DB
		//if( db_connect( config_get('hostname'), config_get('username'), config_get('password'), config_get('database_name') )){
			$now = date("Y-m-d G:i:s");
			$year = $_REQUEST["year"];
			$month = $_REQUEST["month"];
			$day = $_REQUEST["day"];
			
			$query = "INSERT INTO $table
				    		( user, bugid, expenditure_date, hours, costs, time_unit, timestamp, info )
				  		VALUES
				    		( '$user', '$bug_id', '$year-$month-$day', '$time_value', '$costs', '$time_unit', NOW(), '$time_info')";
			if(!db_query($query)){
				trigger_error( ERROR_DB_QUERY_FAILED, ERROR );
			}
			
			# Event is logged in the project
			history_log_event_direct( $bug_id, lang_get( 'time_tracking_history' ). ": " . $time_info, "$day.$month.$year: $time_value h.", "set", $user );
		//} else {
		//	trigger_error( ERROR_DB_CONNECT_FAILED, ERROR );
		//}
	}

# DELETE Entry: A time record needs to be deleted
	if( isset($_REQUEST['delete_id']) ){
		$delete_id = $_REQUEST['delete_id'];
		if ( access_has_bug_level( config_get( 'timetracking_delete_threshold' ), $bug_id ) ) {
			//if( db_connect( config_get('hostname'), config_get('username'), config_get('password'), config_get('database_name') )){
        $query_pull_timerecords = "SELECT * FROM $table WHERE id = $delete_id ORDER BY expenditure_date DESC";
        $result_pull_timerecords = db_query($query_pull_timerecords);
        $row = db_fetch_array( $result_pull_timerecords );
				$query_delete = "DELETE FROM $table WHERE id = $delete_id";        
				db_query($query_delete);
        # Event is logged in the project
        history_log_event_direct( $bug_id, lang_get( 'time_tracking_history' ). " " . lang_get('time_tracking_deleted') . ": " . $row['info'], date("d.m.Y", strtotime($row["expenditure_date"])) . ": " . number_format($row["hours"], 2, ',', '.') . " h.", "deleted", $user );
			//} else {
			//	trigger_error( ERROR_DB_CONNECT_FAILED, ERROR );
			//}
		}
	}

# Pull all Time-Record entries for the current Bug
	//if( db_connect( config_get('hostname'), config_get('username'), config_get('password'), config_get('database_name') )){
		$query_pull_timerecords = "SELECT * FROM $table WHERE bugid = $bug_id ORDER BY expenditure_date DESC";
		$result_pull_timerecords = db_query($query_pull_timerecords);
		$num_timerecords = db_num_rows( $result_pull_timerecords );
	//} else {
	//	trigger_error( ERROR_DB_CONNECT_FAILED, ERROR );
	//}
	
# Get Sum for this bug
	//if( db_connect( config_get('hostname'), config_get('username'), config_get('password'), config_get('database_name') )){
		$table = config_get("timetracking_table");
		$query_pull_costs_hours = "SELECT SUM(costs) as costs, SUM(hours) as hours FROM $table WHERE bugid = $bug_id";
		$result_pull_costs_hours = db_query($query_pull_costs_hours);
		$row_pull_costs_hours = db_fetch_array( $result_pull_costs_hours );		
	//} else {
	//	trigger_error( ERROR_DB_CONNECT_FAILED, ERROR );
	//}

if(access_has_bug_level( config_get( 'timetracking_add_threshold' ), $f_bug_id )) {
?>
<tr>
  <td class="center" colspan="6">

<br>
<?php 
//if ( access_has_bug_level( config_get( 'timetracking_delete_threshold' ), $bug_id ) ) { 
//	$colspan=7;
//} else {
	$colspan=6;
//} ?>
  <table class="width100" cellspacing="1">
    <tr>
      <td colspan="<?php echo $colspan ?>" class="row-category"><div align="left"><a name="timerecord"></a><?php echo lang_get( 'time_tracking' ); ?></div>
      </td>
    </tr>
    <tr class="row-category">
      <td><div align="center"><?php echo lang_get( 'time_user' ); ?></div>
      </td>
      <td><div align="center"><?php echo lang_get( 'time_expenditure_date' ); ?></div>
      </td>
      <td><div align="center"><?php echo lang_get( 'time_hours' ); ?>/<?php echo lang_get( 'time_mandays' ); ?></div>
      </td>
      <td><div align="center"><?php echo lang_get( 'time_information' ); ?></div>
      </td>
<?php //if ( access_has_bug_level( config_get( 'timetracking_delete_threshold' ), $bug_id ) ) { ?>
      <!-- <td><div align="center"><?php echo lang_get( 'time_costs_auto' ); ?></div>
      </td> -->
<?php //} ?>
      <td><div align="center"><?php echo lang_get( 'time_entry_date' ); ?></div>
      </td>
      <td>&nbsp;</td>
    </tr>
	
	<?php if ( access_has_bug_level( config_get( 'timetracking_add_threshold' ), $bug_id ) ) { ?>
	
	<form name="time_tracking" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>#timerecord">

	<? # Nesessary Parameter. Due to base inconsistency we have a double entry ?>
	<input type="hidden" name="bug_id" value="<?php echo $bug_id;  ?>">
	<input type="hidden" name="id" value="<?php echo $bug_id;  ?>">
	
    <tr <?php echo helper_alternate_class() ?>>
      <td><? echo user_get_name( auth_get_current_user_id() ) ?></td>
      <td nowrap><div align="center">
        <?php 
			$current_date = explode ("-", date("Y-m-d"));
		?>
          <select tabindex="5" name="day">
            <?php print_day_option_list( $current_date[2] ) ?>
          </select>
          <select tabindex="6" name="month">
            <?php print_month_option_list( $current_date[1] ) ?>
          </select>
          <select tabindex="7" name="year">
            <?php print_year_option_list( $current_date[0] ) ?>
          </select>
        </div>
      </td>
      <td><table width="100%" border="0" cellspacing="1">
          <tr>
            <td><div align="right">
                <select name="time_unit">
                  <option value="hr" selected><?php echo lang_get( 'time_hours' ) ?></option>
                  <option value="md"><?php echo lang_get( 'time_mandays' ) ?></option>
                </select>
              </div>
            </td>
            <td><div align="left">
                <input name="time_value" type="text">
              </div>
            </td>
          </tr>
        </table>
      </td>
      <td><div align="center">
          <input type="text" name="time_info">
        </div>
      </td>
<?php //if ( access_has_bug_level( config_get( 'timetracking_delete_threshold' ), $bug_id ) ) { ?>
      <!-- <td>&nbsp;</td> -->
<?php // } ?>
      <td>
      </td>
      <td><input name="<?php echo lang_get( 'time_submit' ) ?>" type="submit" value="<?php echo lang_get( 'time_submit' ) ?>">
      </td>
    </tr>
	</form>
	<? } # END Access Control ?>
    <?php
		for ( $i=0; $i < $num_timerecords; $i++ ) {
			$row = db_fetch_array( $result_pull_timerecords );
	?>
    <tr <?php echo helper_alternate_class() ?>>
      <td><? echo user_get_name($row["user"]); ?></td>
      <td><div align="center"><?php echo date("d.m.Y", strtotime($row["expenditure_date"])); ?> </div>
      </td>
	  <? 
	  	$mdBold = "";
		$mdBoldStop = "";
		$hrBold = "";
		$hrBoldStop = "";
			
		if($row["time_unit"]=="md"){
			$mdBold = "<b>";
			$mdBoldStop = "</b>";
			$hrBold = "";
			$hrBoldStop = "";
		} else {
			$mdBold = "";
			$mdBoldStop = "";
			$hrBold = "<b>";
			$hrBoldStop = "</b>";
		}
	  
	  ?>
      <td><div align="right"><?php echo $hrBold.number_format($row["hours"], 2, ',', '.').$hrBoldStop; ?> / <?php echo $mdBold.number_format($row["hours"]/config_get('consultant_manday_definition'), 2, ',', '.').$mdBoldStop; ?></div>
      </td>
      <td><?php echo $row["info"]; ?> </td>
<?php //if ( access_has_bug_level( config_get( 'timetracking_delete_threshold' ), $bug_id ) ) { ?>
      <!-- <td><div align="right"><?php echo number_format($row["costs"], 2, ',', '.'); ?> &euro;</div> -->
<?php //} ?>
      </td>
      <td><div align="center"><?php echo date("d.m.Y G:i:s", strtotime($row["timestamp"])); ?> </div>
      </td>
      <td>
	<?php # DELETE Button just available for 'Delete-Bug Users'
			if ( access_has_bug_level( config_get( 'timetracking_delete_threshold' ), $bug_id ) ) {?>
			<a href="<?php echo $_SERVER['PHP_SELF']; ?>?bug_id=<?php echo $bug_id; ?>&id=<?php echo $bug_id; ?>&delete_id=<?php echo $row["id"]; ?>#timerecord"><?php echo lang_get( 'time_tracking_delete' ) ?></a></td>
	<?php } ?>
	</tr>
    <?php } ?>
	<tr class="row-category">
      <td><?php echo lang_get( 'time_sum' ) ?></td>
      <td>&nbsp;</td>
      <td><div align="center"><b><?php echo number_format($row_pull_costs_hours['hours'], 2, ',', '.'); ?> / <?php echo number_format($row_pull_costs_hours['hours']/config_get('consultant_manday_definition'), 2, ',', '.'); ?></b></div></td>
      <td>&nbsp;</td>
<?php //if ( access_has_bug_level( config_get( 'timetracking_delete_threshold' ), $bug_id ) ) { ?>
      <!-- <td><div align="center"><b><?php echo number_format($row_pull_costs_hours['costs'], 2, ',', '.'); ?> &euro;</b></div></td> -->
<?php //} ?>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
  </table>
  </td>
</tr>
<?php
}
?>
Hope this solves your problem.

Cas
jmforesite
Posts: 4
Joined: 11 Jul 2006, 20:22

almost there

Post by jmforesite »

I can enter time now, but when time is entered I get this error.

APPLICATION ERROR #401

Database query failed. Error received from database was #1265: Data truncated for column 'timestamp' at row 1 for the query: INSERT INTO mantis_module_timetracking
( user, bugid, expenditure_date, hours, costs, time_unit, timestamp, info )
VALUES
( '2', '174', '2006-7-12', '1', '10', 'hr', NOW(), 'wew')
cas
Posts: 1586
Joined: 11 Mar 2006, 16:08
Contact:

Post by cas »

here is the correct SQL for the table:
CREATE TABLE `mantis_module_timetracking` (
`id` int(11) NOT NULL auto_increment,
`bugid` int(11) default NULL,
`user` int(11) default NULL,
`expenditure_date` date default NULL,
`hours` double(15,3) default NULL,
`costs` double(15,3) default NULL,
`time_unit` enum('md','hr') default 'hr',
`timestamp` bigint(20) unsigned zerofill NOT NULL default '00000000000000000000',
`info` varchar(255) default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
That should solve the last ussue.

Cas
jmforesite
Posts: 4
Joined: 11 Jul 2006, 20:22

still getting this after dumping table and running sql query

Post by jmforesite »

APPLICATION ERROR #401

Database query failed. Error received from database was #1265: Data truncated for column 'timestamp' at row 1 for the query: INSERT INTO mantis_module_timetracking
( user, bugid, expenditure_date, hours, costs, time_unit, timestamp, info )
VALUES
( '2', '174', '2006-7-12', '1', '10', 'hr', NOW(), 'testing')

Please use the "Back" button in your web browser to return to the previous page. There you can correct whatever problems were identified in this error or select another action. You can also click an option from the menu bar to go directly to a new section.
cas
Posts: 1586
Joined: 11 Mar 2006, 16:08
Contact:

Post by cas »

It helps when one checks the solution offered.
The correct SQL syntax is :

Code: Select all

CREATE TABLE `mantis_module_timetracking` (
  `id` int(11) NOT NULL auto_increment,
  `bugid` int(11) default NULL,
  `user` int(11) default NULL,
  `expenditure_date` date default NULL,
  `hours` double(15,3) default NULL,
  `costs` double(15,3) default NULL,
  `time_unit` enum('md','hr') default 'hr',
  `timestamp` datetime NOT NULL default '0000-00-00 00:00:00',
  `info` varchar(255) default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
The difference is within the definition of Timestamp, it needs to be DateTime.

Cas
jmforesite
Posts: 4
Joined: 11 Jul 2006, 20:22

getting one more set of errors in the report page

Post by jmforesite »

Almost there - only more set of errors. Thanks for the help hus far

APPLICATION WARNING #300: String 'print_time_tracking_from' not found.


APPLICATION WARNING #300: String 'print_time_tracking_to' not found.

APPLICATION WARNING #300: String 'print_time_tracking_update' not found.
Post Reply