Make note entry mandatory when closing a ticket

General discussion of Mantis.

Moderators: Developer, Contributor

Post Reply
Diagram
Posts: 2
Joined: 03 Apr 2024, 07:09

Make note entry mandatory when closing a ticket

Post by Diagram »

Hi,

Is it possible to make entering a note mandatory when a user closes a ticket?

THANKS
cas
Posts: 1768
Joined: 11 Mar 2006, 16:08
Contact:

Re: Make note entry mandatory when closing a ticket

Post by cas »

Not out of the box so a plugin would be needed here :mrgreen:
vic-t
Posts: 6
Joined: 20 Apr 2022, 12:23

Re: Make note entry mandatory when closing a ticket

Post by vic-t »

Same issue here. I'm managing a BT for a third party software. It's generally a symbiotic relationship but they're driving me mad sometimes by simply closing issues as fixed without providing any insight as to how their solution looks like. Meaning I have to wait for them to create a new release to just realize then that the solution is not sufficient.

I tried dealing with this in various ways but I've come to a point where I'd simply like to restrict them closing issues without a comment.

Too bad there's nothing out there yet. Any hints how involved the development of such a feature could be?
cas
Posts: 1768
Joined: 11 Mar 2006, 16:08
Contact:

Re: Make note entry mandatory when closing a ticket

Post by cas »

What you can do, is to change the workflow.
Make sure that rights to close are only with the manager or higher, developers (or any other group of your choice) is only allowed to mark a ticket as resolved.

Making the note required when closing (or resolving) can be achieved either through a small plugin or by a a custom function build upon "issue_update_validate".
On Page 98 of the Admin guide the chapter "Custom Functions" starts.
Since this is your lucky day, a sample is given around exactly the function you would need to adjust.
Your code wloulkd look like this

Code: Select all

function custom_function_override_issue_update_validate( $p_issue_id, $p_bug_data, $p_bugnote ) {
	if( $p_bug_data->status == CLOSED ) {
		if( strlen( trim( $p_bugnote ) ) === 0 ) {
			error_parameters( 'No Note provided, issue cannot be closed' );
			trigger_error( ERROR_VALIDATE_FAILURE, ERROR );
		}
	}
}
If you want to try it out, do follow the guidelines given in the Admin guide.
Now this functionality will disappear over time in favor of the plugin solution which in the end is much more powerful. But it will do the trick for now :mrgreen:
Post Reply