How can I make standard fields required

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
Pjettrekk
Posts: 5
Joined: 17 Feb 2010, 22:25

How can I make standard fields required

Post 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 :/
atrol
Site Admin
Posts: 8549
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: How can I make standard fields required

Post by atrol »

have a look at function validate in bug_api.php
Please use Search before posting and read the Manual
Pjettrekk
Posts: 5
Joined: 17 Feb 2010, 22:25

Re: How can I make standard fields required

Post 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 :/
atrol
Site Admin
Posts: 8549
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: How can I make standard fields required

Post 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 );
          }
Please use Search before posting and read the Manual
Pjettrekk
Posts: 5
Joined: 17 Feb 2010, 22:25

Re: How can I make standard fields required

Post 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?
atrol
Site Admin
Posts: 8549
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: How can I make standard fields required

Post by atrol »

I shouldn't have copy / pasted your code :?
must be ($this->version) and not ($this->product_version)
Please use Search before posting and read the Manual
Pjettrekk
Posts: 5
Joined: 17 Feb 2010, 22:25

Re: How can I make standard fields required

Post 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 :(
Pjettrekk
Posts: 5
Joined: 17 Feb 2010, 22:25

Re: How can I make standard fields required

Post by Pjettrekk »

bump
Nobody know what's wrong :?: :(
atrol
Site Admin
Posts: 8549
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: How can I make standard fields required

Post 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
Please use Search before posting and read the Manual
margarf
Posts: 1
Joined: 17 Jun 2010, 10:52

Re: How can I make standard fields required

Post 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 );
< }
< }
phoenixcreation
Posts: 7
Joined: 20 Aug 2007, 12:51

Re: How can I make standard fields required

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