Page 1 of 1

Removing Required Fields

Posted: 09 Dec 2005, 12:04
by DangerMouse
Hi all,

I'm working on a project to adapt the Mantis sytem for another purpose, completely different to bug tracking but using similar life cycle processes.

I have created a variety of custom fields and have ammended the HTML code to remove those parts that I do not need displayed. However as some fields are deemed "required" fields by default this causes problems on record submission.

Is it possible to adjust the status of required fields? If so where can this be done?

Many thanks

Steve

Posted: 11 Dec 2005, 22:05
by vboctor
This can be done by changing bug_report.php. You will need to change the line that gets the required field as follows:

$f_required_field = gpc_get_string('required_field');

to

$f_required_field = gpc_get_string('required_field', 'default value');

Regards,
Victor
MantisConnect
http://www.futureware.biz/mantisconnect

Posted: 13 Dec 2005, 15:00
by DangerMouse
Apologies for probably being very stupid but i cant seem to find that string in bug_report.php

Steve

Posted: 13 Dec 2005, 15:21
by DangerMouse
Yep being very stupid, I now see what you mean I think.

Thanks

Posted: 13 Dec 2005, 16:02
by DangerMouse
Hmm nope, just tested what I thought was the solution and failed misserably :(

I assumed that where u put "required_field" you meant replace with the actual required field however this does not appear to work.

Posted: 13 Dec 2005, 17:51
by Narcissus
Steve:

In bug_report.php near the top of the page you'll see a line that reads:
$t_bug_data = new BugData;

Then after that, there's the various functions that are called to populate various fields in the $t_bug_data object. The assignments here that have a second parameter in the gpc_get_* functions are considered optional.

Assume, for example, that you want to make the 'summary' field optional.

There's a line there that reads:
$t_bug_data->summary = gpc_get_string( 'summary' );

You need to replace that line with:
$t_bug_data->summary = gpc_get_string( 'summary', '' );

to make the field optional.

If you still have problems, feel free to hop on IRC and ask there...

Hope this helps,
Lincoln.

Posted: 15 Dec 2005, 11:00
by DangerMouse
This is very strange, that's what I've been ammending.

I'm having trouble with the line:

$t_bug_data->description = gpc_get_string( 'description', '' );

This has been ammended as you suggest but on "submittal" I still get an error saying the field has not been completed.

I'm afraid I cant get access to IRC from here, ports are blocked by office firewall - any suggestions on a good IRC web based client?

Posted: 15 Dec 2005, 11:39
by vboctor
Summary and description are mandatory fields. This is enforced in core/bug_api.php. You can get arround this problem by defaulting the description to 'none' or to the same value as summary (in case it is empty).

Regards,
Victor
MantisConnect
http://www.futureware.biz/mantisconnect

Posted: 15 Dec 2005, 11:52
by DangerMouse
Defaulting the description would be done as illustrated above?

How would I go about defaulting the value to that in the summary field?

Thanks

Steve

Posted: 15 Dec 2005, 13:18
by Guest
Option 1: Default description to none.

Code: Select all

$t_bug_data->description = gpc_get_string( 'description', 'none' ); 
Option 2: Default description to summary.

Code: Select all

$t_bug_data->description = gpc_get_string( 'description', '' ); 
if ( is_blank( $t_bug_data->description ) ) {
    $t_bug_data->description = $t_bug_data->summary;
}
Regards,
Victor
Mantis Blog
http://www.futureware.biz/

Posted: 15 Dec 2005, 13:31
by DangerMouse
Thanks alot!

Almost baffled me with wierd forum links but got there in the end.

Really appreciated, I dont wish to be spoon fed, but I'm not a programmer either so making these ammends is proving difficult.

Thanks

Steve

Mandatory Fields per Project

Posted: 28 Aug 2006, 08:04
by agoerzen
Hello,

can I do this also per project?
I think I understood the above.
I want to have summary an subject not mandatory only for one specific project. Is that possible?

Thx in advance
Andreas

Sorry forgot: Mantis Version is 1.0.1

Re: Removing Required Fields

Posted: 04 Jan 2017, 12:08
by Rajankit
Hello,

I am also facing same problem, i want to remove mandatory fields, but i can't able to do that
i have tried below mentioned statements in bug_report.php
$t_bug_data->description = gpc_get_string( 'description', 'none' );
or
$t_bug_data->description = gpc_get_string( 'description', '' );
even i tried to update in config_inc.php,
But none of the above worked for me
i am using mantis version 1.3.1
can any one suggest me what to do ?

Thanks & Regards,
Ankit Raj

Re: Removing Required Fields

Posted: 18 Aug 2017, 12:22
by Ancy
I am also in a situation where i couldn't remove any of the fields that i wanted to remove from the 'report issue ' page..can someone help me?
Much appreciated

Re: Removing Required Fields

Posted: 18 Aug 2017, 13:59
by Ancy
Please don't go this complex.You can take a look on below post of mine.
http://www.mantisbt.org/forums/viewtopi ... =4&t=24913