Use custom field in Change Log

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
sologroupmc
Posts: 9
Joined: 24 Jul 2006, 22:07
Location: Chicago, IL, US
Contact:

Use custom field in Change Log

Post by sologroupmc »

Using version 105 on freebsd.
Viewing vboctor's blog, the place to modify the Change log is in the custom function
custom_function_default_changelog_print_issue
which we added to the custom file as
custom_function_override_changelog_print_issue

We would like to add a custom field to this function.

Specifically, we have a created a ReleaseNotes custom field that allow the developer to add information whenever an issue is fixed. I would like to have this information printed in the ChangeLog instead of the summary (it makes more sense to us to describe what was done and why, rather than just print the issue summary which may only be a small part of what was done to resolve the issue.

Thanks!
vboctor
Site Admin
Posts: 1304
Joined: 13 Feb 2005, 22:11
Location: Redmond, Washington
Contact:

Post by vboctor »

Try using the following code:

$p_custom_field is the custom field name. $p_project_id is the project id, $p_issue_id is the issue id.

Code: Select all

			$t_field_id = custom_field_get_id_from_name( $p_custom_field );
			if ( $t_field_id === false ) {
				echo '@', $p_custom_field, '@';
			} else {
				if ( custom_field_is_linked( $t_field_id, $p_project_id ) ) {
					$t_def = custom_field_get_definition( $t_field_id );
					print_custom_field_value( $t_def, $t_field_id, $p_issue_id );
				} else {
					// field is not linked to project
					echo $t_column_empty;
				}
			}
Regards,
Victor
Mantis for Mobile Devices
http://www.futureware.biz/mantiswap
sologroupmc
Posts: 9
Joined: 24 Jul 2006, 22:07
Location: Chicago, IL, US
Contact:

Post by sologroupmc »

Thank you Victor! That works very well and I can format the output in the changelog screen as I wanted.

A questions regarding the code, is there a function that will pull the current project ID for use in the function you sent? I would like to send the function both the custom field name and the project id - I imagine there is a function that gets this value.

Thanks again!
vboctor
Site Admin
Posts: 1304
Joined: 13 Feb 2005, 22:11
Location: Redmond, Washington
Contact:

Post by vboctor »

You don't need the current project id, you need the project id of the issue you are working with. This is to be able to handle the Changelog for "All Projects". You can get the project id from the issue id as follows:

Code: Select all

bug_get_field( $p_issue_id, 'project_id' );
Regards,
Victor
Connect you Java Apps to Mantis
http://www.futureware.biz/mantisconnect
Post Reply