Hello world,
how can I configure Mantis 1.1.2 to make a built-in field (e. g. "Product Build") mandatory when a reporter enters a new issue?
All I found in the docs and the internet refers to custom fields only...
Cheers,
Jens
Ho to make a field mandatory?
Moderators: Developer, Contributor
Re: Ho to make a field mandatory?
I think you want to take a look at this thread: http://www.mantisbt.org/forums/viewtopi ... ory#p13943
I had the same question and found this solution with a little searching around this forum.
Good luck!
I had the same question and found this solution with a little searching around this forum.
Good luck!
Re: Ho to make a field mandatory?
NOTE: I did find that the solution did not work for me exactly as-is for version 1.1.2. The line:
define( 'ERROR_BUG_UPDATE_VALIDATE_FAILURE', 10001 );
That the solution states should be in custom_functions_inc.php actually needs to be in the file custom_constant_inc.php. Otherwise this solution works perfectly!
The next piece I'm trying to get is I want an asterisk to appear by the required field on the specified page. Once I have it, I'll post the solution here.
define( 'ERROR_BUG_UPDATE_VALIDATE_FAILURE', 10001 );
That the solution states should be in custom_functions_inc.php actually needs to be in the file custom_constant_inc.php. Otherwise this solution works perfectly!
The next piece I'm trying to get is I want an asterisk to appear by the required field on the specified page. Once I have it, I'll post the solution here.
Re: Ho to make a field mandatory?
Disclaimer: I don't know how these changes will be retained at the next upgrade you take, but they work perfectly. It would be nice if there was a config file that we could define a field(s) that was mandatory and in which state(s).
To get the asterisk (*) by the field and the nice little "* required" by the submit button, I updated bug_change_status_page.php to change the following -
changed this:
to this:
To get the "* required" by the submit button I changed this:
to this:
As you can see, my specific goal was to identify the "Fixed in Version" field as a required field when transitioning an issue to the resolved state. These changes work great. I will probably end up modifying my implementation so that it is also mandatory when transitioning the change request to the "closed" state as well.
To get the asterisk (*) by the field and the nice little "* required" by the submit button, I updated bug_change_status_page.php to change the following -
changed this:
Code: Select all
<?php echo lang_get( 'fixed_in_version' ) ?>
Code: Select all
<?php if ( $f_new_status == $t_resolved ) { ?>
<span class="required">*</span><?php echo lang_get( 'fixed_in_version' ) ?>
<?php } else { ?>
<?php echo lang_get( 'fixed_in_version' ) ?>
<?php } ?>
Code: Select all
<td class="center" colspan="2">
<input type="submit" class="button" value="<?php echo lang_get( $t_status_label . '_bug_button' ) ?>" />
</td>
Code: Select all
<td class="left">
<span class="required"> * <?php echo lang_get( 'required' ) ?></span>
</td>
<td class="center">
<input type="submit" class="button" value="<?php echo lang_get( $t_status_label . '_bug_button' ) ?>" />
</td>
Re: Ho to make a field mandatory?
Closing the loop on this, to ensure the field is populated and marked as required from the desired state on, you just change the checks for the code we added/updated in both custom_functions_inc.php and bug_change_status_page.php to be ">=" instead of "==". I should have seen that earlier.