require native field

Post about your customizations to share with others.

Moderators: Developer, Contributor

Post Reply
yawo
Posts: 36
Joined: 17 Sep 2012, 10:01
Location: gometz le châtel (france)

require native field

Post by yawo »

i just want to make the native field "fixed in version" mandatory before resolving any issues. I red the other post about it and try to apply codes but it can not work. is it not possible with native fields? or the appropriate function is not fixed in custom_functions_inc.php ?
yawo
Posts: 36
Joined: 17 Sep 2012, 10:01
Location: gometz le châtel (france)

Re: require native field

Post by yawo »

I just come to resolve the problem by adding these lines :
if(is_blank($this->fixed_in_version)){
//error_parameters(lang_get('fixed in version'));
trigger_error( ERROR_EMPTY_FIELD, ERROR);
}
in bug_api.php in the function validate( $p_update_extended = true).
now i want this only for a specific project. what can i do?
atrol
Site Admin
Posts: 8378
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: require native field

Post by atrol »

I recommend to write a custom validation function custom_function_default_issue_create_validate instead of changing any existing source code of MantisBT.
http://www.mantisbt.org/docs/master-1.2 ... USTOMFUNCS
Please use Search before posting and read the Manual
cas
Posts: 1622
Joined: 11 Mar 2006, 16:08
Contact:

Re: require native field

Post by cas »

Just put your code between another IF statement that checks for the correct project-id, something like :
if ($this->project_id==24){
your code
}
yawo
Posts: 36
Joined: 17 Sep 2012, 10:01
Location: gometz le châtel (france)

Re: require native field

Post by yawo »

thanks!! it's working but i do not manage to resolve the problem by ATROL's method!! i red the doc and i apply changes but i didn't understand why it's not working..even if i put the example of the doc to see the effect, i can not notice anything!! perhaps i don't know what exactely to put as parameter of the function "function custom_function_override_issue_create_validate($p_new_issue_data)" .. For the moment i'll keep the one who works(modifications done in bug-api) while looking for the way to resolve it by custom function!!..
atrol
Site Admin
Posts: 8378
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: require native field

Post by atrol »

Sorry, the name of the function should be custom_function_override_issue_create_validate
Please use Search before posting and read the Manual
cas
Posts: 1622
Joined: 11 Mar 2006, 16:08
Contact:

Re: require native field

Post by cas »

Suggest you do use Atrol's method since it will be available also after an upgrade.
I am sure if you use the script name from his last mail, it'll work ok. :mrgreen:
yawo
Posts: 36
Joined: 17 Sep 2012, 10:01
Location: gometz le châtel (france)

Re: require native field

Post by yawo »

I'm a little amazed.. it's exactely what i'he put as the name of the function. it still doesn't work.
yawo
Posts: 36
Joined: 17 Sep 2012, 10:01
Location: gometz le châtel (france)

Re: require native field

Post by yawo »

it's working now!! it was just a bad paste of the code!! i rewrite it myself else everything was correct! thank you!! i will now adapt it to my needs.
Post Reply