How to make a field not mandatory

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
mamathak
Posts: 20
Joined: 03 Dec 2010, 15:22

How to make a field not mandatory

Post by mamathak »

Hi,

I am using Mantis 1.2.4.
When reporting a bug we don't want the description field to be mandatory. How can i do that?

Thanks for any help.
Mamtha
atrol
Site Admin
Posts: 8536
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: How to make a field not mandatory

Post by atrol »

This is not possible by customizing a parameter.
You would have to change the source code to get this.
But I am not sure if all of the source code of MantisBT will be able to deal with empty descriptions.

As a workaround you could write a plugin which fills the description field if it's empty (maybe duplicates the summary)
Please use Search before posting and read the Manual
cas
Posts: 1768
Joined: 11 Mar 2006, 16:08
Contact:

Re: How to make a field not mandatory

Post by cas »

in core\bug_api.php you will find (line 272):

Code: Select all

if( $p_update_extended ) {
	# Description field cannot be empty
	if( is_blank( $this->description ) ) {
		error_parameters( lang_get( 'description' ) );
		trigger_error( ERROR_EMPTY_FIELD, ERROR );
	}
}
change it into:

Code: Select all

if( $p_update_extended ) {
	# Description field cannot be empty
	if( is_blank( $this->description ) ) {
//		error_parameters( lang_get( 'description' ) );
//		trigger_error( ERROR_EMPTY_FIELD, ERROR );
	}
}
That may do the trick :D
mamathak
Posts: 20
Joined: 03 Dec 2010, 15:22

Re: How to make a field not mandatory

Post by mamathak »

Hi Cas, Thanks for the suggestion and sorry to say that it didn't work.
Hi atrol, Thanks for the reply. Being a tester, I am not good with coding. Is it possible to give me a code to duplicate the summary into description field please ?

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

Re: How to make a field not mandatory

Post by cas »

Hi Mamatha,
apart from the very true comment from Atrol, my solution does work (just tried and proved). Suggest you try again 8)
mamathak
Posts: 20
Joined: 03 Dec 2010, 15:22

Re: How to make a field not mandatory

Post by mamathak »

Hi Cas,

Thanks a lot. That worked. Sorry, previously i didn't do it properly.
Once again thanks,
Mamatha
Post Reply