Problem with issue_create_validate?

Post about your customizations to share with others.

Moderators: Developer, Contributor

Post Reply
bmason
Posts: 6
Joined: Aug 29, 2019 2:56 pm

Problem with issue_create_validate?

Post by bmason » Oct 23, 2019 3:44 pm

I am sorry to bother you. I know I am a noob but this is driving me crazy.

I successfully added this hook to my custom_function_inc.php file and it is working:

Code: Select all

/** * Hook to validate Validate field settings before resolving
  * verify that the Fixed In Version is set (if versions of the product exist) */ 

function custom_function_override_issue_update_validate( $p_issue_id, $p_bug_data, $p_bugnote_text ) {
 	if( $p_bug_data->status == RESOLVED ) {
  		
		$t_version_count = count( version_get_all_rows( $p_bug_data->project_id ) );
		if( ( $t_version_count > 0 ) && ( $p_bug_data->fixed_in_version == '' ) ) {
   			error_parameters( 'Fixed In Version' );
   			trigger_error( ERROR_EMPTY_FIELD, ERROR );  
		}
 	}
 }
Inspired by this success, I decided to make the Product Version field required when a user submits a new bug. In trying to debug this, I have commented out every line in the hook except the following:

Code: Select all

# Check to see if bug has Product Version set:
function custom_function_overrride_issue_create_validate( $p_new_issue_data ) { 
		error_parameters( 'product_version' );
		trigger_error( ERROR_EMPTY_FIELD, ERROR );	
}
I would expect that this would effectively prevent anyone from submitting bugs, but it has no effect whatsoever. It looks like this custom function isn't running at all (but as I said, the custom_function_override_issue_update_validate function, in the same file, is working). Is this a problem with my version of MantisBT (2.22.0), or have I messed something up?

Post Reply