Page 1 of 1
How can I make standard fields required
Posted: 17 Feb 2010, 22:31
by Pjettrekk
Hi
I have MantiBT 1.2.0rc2 and I want to make some fields as required. I was edited, bug_report_page.php and added <span class="required">*</span> but, it's just visual effect. What, I must do to make some existing fields as required?
Sorry, for my bad English :/
Re: How can I make standard fields required
Posted: 18 Feb 2010, 11:58
by atrol
have a look at function validate in bug_api.php
Re: How can I make standard fields required
Posted: 18 Feb 2010, 13:58
by Pjettrekk
I was edited this file but it's not working correctly :/ I write
Code: Select all
# Make sure a category is set
if( 0 == $this->product_version ) {
error_parameters( lang_get( 'product_version' ) );
trigger_error( ERROR_EMPTY_FIELD, ERROR );
}
in 287 line.
The alert, about blank field is after every Send, even when the product version is chosen :/
In assign_to is the same :/
Re: How can I make standard fields required
Posted: 18 Feb 2010, 15:01
by atrol
This should work, I didn't try
product_version is not numeric
Code: Select all
if( is_blank ($this->product_version) ) {
error_parameters( lang_get( 'product_version' ) );
trigger_error( ERROR_EMPTY_FIELD, ERROR );
}
Re: How can I make standard fields required
Posted: 21 Feb 2010, 08:06
by Pjettrekk
:/ It's not work

Always after click Send button it's a alert about blank field Product version, even is chosen.
Any idea, what can I do?
Re: How can I make standard fields required
Posted: 22 Feb 2010, 18:27
by atrol
I shouldn't have copy / pasted your code
must be ($this->version) and not ($this->product_version)
Re: How can I make standard fields required
Posted: 23 Feb 2010, 00:05
by Pjettrekk
Thanks atrol
now it's working
Code: Select all
if( is_blank ($this->version) ) {
error_parameters( lang_get( 'product_version' ) );
trigger_error( ERROR_EMPTY_FIELD, ERROR );
}
but what's about Assing to? I was trying:
Code: Select all
if( is_blank ($this->assign_to) ) {
error_parameters( lang_get( 'assign_to' ) );
trigger_error( ERROR_EMPTY_FIELD, ERROR );
}
and
Code: Select all
if( is_blank ($this->handler_id) ) {
error_parameters( lang_get( 'assign_to' ) );
trigger_error( ERROR_EMPTY_FIELD, ERROR );
}
but it isn't working

Re: How can I make standard fields required
Posted: 01 Mar 2010, 21:10
by Pjettrekk
bump
Nobody know what's wrong

Re: How can I make standard fields required
Posted: 02 Mar 2010, 22:31
by atrol
Maybe open source freeware is not the best solution for you.
You should be aware that there will not be all the time someone who has a look at your changes of sourcecode.
For long term you have two options when using MantisBT:
a) learn some more of PHP, databases, html, how MantisBT works and / or
b) buy some support
a further hint (which I did'nt try!)
0 == $this->handler_id
Re: How can I make standard fields required
Posted: 17 Jun 2010, 10:57
by margarf
Hi, I put target_version as a required field ant its works. After lines referenced to summary and description and I add this:
if( $p_update_extended ) {
< # target_version field cannot be empty
< if( is_blank( $this->target_version ) ) {
< error_parameters( lang_get( 'target_version' ) );
< trigger_error( ERROR_EMPTY_FIELD, ERROR );
< }
< }
Re: How can I make standard fields required
Posted: 20 Jun 2010, 22:44
by phoenixcreation
Ahhh, found this thread as well. I've been working on this as well, but focusing on the due_date field being required. I've tried mimicing the description and summary entries:
if( $p_update_extended ) {
# due_date field cannot be empty
if( is_blank( $this->due_date) ) {
error_parameters( lang_get( 'due_date' ) );
trigger_error( ERROR_EMPTY_FIELD, ERROR );
}
}
With no success. I have also gone a little further down into the file and tried to do the above within the create function:
# check due_date format
if( is_blank( $this->due_date ) ) {
$this_due_date = date_get_null();
}
Either way if I leave the due_date blank it lets the bug get added. Am I missing something in the above? Could it have to do with "1" being the default entry in the database when a due_date is blank?