Removing Required Fields

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
DangerMouse

Removing Required Fields

Post 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
vboctor
Site Admin
Posts: 1293
Joined: 13 Feb 2005, 22:11
Location: Redmond, Washington
Contact:

Post 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
DangerMouse

Post by DangerMouse »

Apologies for probably being very stupid but i cant seem to find that string in bug_report.php

Steve
DangerMouse

Post by DangerMouse »

Yep being very stupid, I now see what you mean I think.

Thanks
DangerMouse

Post 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.
Narcissus
Developer
Posts: 338
Joined: 17 Feb 2005, 09:45

Post 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.
DangerMouse

Post 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?
vboctor
Site Admin
Posts: 1293
Joined: 13 Feb 2005, 22:11
Location: Redmond, Washington
Contact:

Post 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
DangerMouse

Post 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
Guest

Post 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/
DangerMouse

Post 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
agoerzen
Posts: 5
Joined: 01 Mar 2006, 14:25

Mandatory Fields per Project

Post 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
Rajankit
Posts: 1
Joined: 04 Jan 2017, 05:06

Re: Removing Required Fields

Post 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
Ancy
Posts: 46
Joined: 30 Jun 2017, 11:10

Re: Removing Required Fields

Post 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
Ancy
Posts: 46
Joined: 30 Jun 2017, 11:10

Re: Removing Required Fields

Post 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
Post Reply