Page 1 of 1
Get the bug id after submting bug
Posted: 08 Nov 2018, 14:55
by Amin
Hello,
I would like to get the bug_id after submiting an bug in order to use it after to do something
I have do that but I'm not sur that it's working correctly :
$p_issue_id =helper_get_current_project();
$t_bug = bug_get( $p_issue_id );
If someone have another idea I will appreciate his help.
Thank you
Re: Get the bug id after submting bug
Posted: 08 Nov 2018, 15:05
by atrol
You have to write a plugin that uses event EVENT_REPORT_BUG
https://www.mantisbt.org/docs/master/en ... bug.action
Re: Get the bug id after submting bug
Posted: 08 Nov 2018, 15:28
by Amin
Hello Atrol,
Thank you for response
But The EVENT_REPORT_BUG take in parameters Bug data structure and Bug id and he retrun nothing. And I want to get the bug ID.
I need to get the bug ID in order to use it in custom_function_api.php (in a override fonction).
Re: Get the bug id after submting bug
Posted: 08 Nov 2018, 16:03
by atrol
Amin wrote: ↑08 Nov 2018, 15:28The EVENT_REPORT_BUG take in parameters Bug data structure and Bug id and he retrun nothing.
EVENT_REPORT_BUG is not a function, it's an event where you can subscribe to with your own function.
Your own function is called with the bug id as 2nd parameter
From provided documentation link
At this point, the issue ID is actually known, and is passed as a second parameter.
I am talking about plugins, not custom functions.
If you want to use a custom function, you have to write custom_function_override_issue_create_notify which is called with issue id as parameter
https://www.mantisbt.org/docs/master/en ... cs.defined
Keep in mind that custom functions are easier to implement than plugins, but they are limited in terms of functionality and might be removed in Mantis in a later version (not anncounced yet).