Adding Target Dates to Roadmap

Post about your customizations to share with others.

Moderators: Developer, Contributor

Post Reply
tom_glebas
Posts: 14
Joined: 07 Sep 2009, 23:19

Adding Target Dates to Roadmap

Post by tom_glebas »

We wanted to see more information on the Roadmap, including target release dates. In order to do this, we created a custom field for the date "target_date." In order for this to show as "Target Date" on the issue update page, we included the following code in mantis/custom_strings_inc.php (see http://www.mantisbt.org/forums/viewtopic.php?f=2&t=259 for more info on custom_strings_inc.php) (note, we are using 1.1.4):

Code: Select all

<?php
$s_target_date = 'Target Date';
?>
Then, in roadmap_page.php, we made the following changes:

1. Include custom_field_api.php for its functions (added after the require_once for the core.php):

Code: Select all

require_once( $t_core_path.'custom_field_api.php' );
2. Add the following code (The "videoray..." and "...videoray" comments delineate the new code. The other code is exsiting code so you can see where the custom code goes. t's in the vicinity of line 240)

Code: Select all

//videoray...
//initialize the placeholder for the most distant future date so we can track and display it at the end 
			$max_target_date = 0;
//...videoray

			for ( $j = 0; $j < count( $t_issue_set_ids ); $j++ ) {
				$t_issue_set_id = $t_issue_set_ids[$j];
				$t_issue_set_level = $t_issue_set_levels[$j];
				 
//videoray...
//get custom field ids for each project
	$t_related_custom_field_ids = custom_field_get_linked_ids( $t_project_id );
//scroll through ids looking for target_date
	foreach( $t_related_custom_field_ids as $t_id ) {
		$t_def = custom_field_get_definition( $t_id );
		if ($t_def['name'] == "target_date") {
//when target_date is found, get its value
			$t_custom_field_value = custom_field_get_value( $t_id, $t_issue_set_id );
//if the value is not blank, use it
			if ($t_custom_field_value != 0) {
//store the most distant future date to print it at the end of the issues list
			  if ($t_custom_field_value > $max_target_date) {
			    $max_target_date = $t_custom_field_value;
//print the date before printing the issue			    }
			  print_custom_field_value( $t_def, $t_id, $t_issue_set_id );
			  echo " ";
			  }
			}
		}
//...videoray
 				helper_call_custom_function( 'roadmap_print_issue', array( $t_issue_set_id, $t_issue_set_level ) );
3. Then after the number of issues resolved is printed, add code to print the summary date (most distant future date from all issues), or if no issues have dates set, print "TBD"

Code: Select all

				echo sprintf( lang_get( 'resolved_progress' ), $t_issues_resolved, $t_issues_planned, $t_progress );
//videoray...
				echo '<br />Projected Release Date: ';
				if ($max_target_date != 0) {
				  echo date( config_get( 'short_date_format' ), $max_target_date) ;
				  }
				else {
				  echo "TBD";
				  }
//...videoray
Here is an excerpt showing some sample output (only three issues were tagged with target dates):

2009-09-10 - 0000024: [Accessories] 2nd camera (agoldstein) - acknowledged.
2009-09-11 - 0000078: [ROV Control] Lights flash when camera menu is operated - acknowledged.
2009-09-09 - 0000022: [Accessories] Manip needs to be implemented - acknowledged.
- 0000012: [Video] Video becomes very sluggish when recording (agoldstein) - resolved.
- 0000017: [Video] Tilt range and settings may be off - resolved.
...

7 of 10 issue(s) resolved. Progress (70%).
Projected Release Date: 2009-09-11
Post Reply