View Issue Details

IDProjectCategoryView StatusLast Update
0012814mantisbtplug-inspublic2013-08-16 06:33
Reporterzrybola Assigned To 
PrioritynormalSeverityminorReproducibilityN/A
Status newResolutionopen 
Product Version1.2.4 
Summary0012814: EVENT_BUG_CHANGE_STATUS_FORM and EVENT_UPDATE_BUG_DATA events undefined
Description

Hello,
I am planning to implement a plug-in to MantisBT to do some modifications while changing bug status. Unfortunately I have problems right at the beginning.

I found a documentation to develop a plug-in with information about events (http://docs.mantisbt.org/master/en/developers.pdf). I found event EVENT_BUG_CHANGE_STATUS_FORM and EVENT_UPDATE_BUG_DATA in the documentation which seem to fit my need. Unfortunately, when I try to hook them in my plug-in, it is said these events "have not yet been declared". I made some research of the source code and there is really no event signalization for such events.

I want to ask, why are these events mentioned in the documentation but not signaled in the real application code. How can I hook my plug-in to modify bug data while updating? Should I update the core code to include custom event signalization? What about later updates of mantis core - I would lose my changes.

Thanks for your answer and advice.

TagsNo tags attached.

Activities

cas

cas

2011-02-25 02:45

reporter   ~0028292

The documentation of the plugin functionality is not up to date, there is an event called "EVENT_UPDATE_BUG" inside bug_update.php which may be usefull for you.
To find all available events, scan your sources for "event_signal"

zrybola

zrybola

2011-03-01 04:03

reporter   ~0028329

Last edited: 2011-03-01 04:04

Thanks for your help. I got confused about the event references. There are several version on different sites available.
I looked for an event which can compare old and new bug data, but I used EVENT_UPDATE_BUG now and called bug_get() method to get the old bug data to compare with.

zrybola

zrybola

2011-03-01 10:04

reporter   ~0028331

Now I came across another situation.
I need to add an input for a custom field to the form when changing status of a bug from specific status to another. I cannot set the custom field required on update, as it is required only for this specific status update. However, I don't want to "edit" the bug first to be able to change the status.

I searched the source code of page bug_change_status_page.php for signaled events but there is only EVENT_BUGNOTE_ADD_FORM event signaled which is definitely not the one I need.

I have another function hooked to EVENT_UPDATE_BUG to process the status change but this needs the custom field filled in.

What should I do? How can I add an input for a custom field in the change status form? Do I need to edit the core code and add a new signal there? How can I upgrade Mantis to higher version with such changes made in core code?

Thanks a lot for your suggestions.

cas

cas

2011-03-01 10:19

reporter   ~0028332

If you need an event, you can add one in the core code, make sure also to update events_inc.php (for defining the event) . Be aware that updates will take away these changes.
If you use a plugin, you can define new events in the plugin but still need to adjust the core code to have the trigger placed.

zrybola

zrybola

2011-03-01 10:21

reporter   ~0028333

I was afraid of this. I will have to add an event and make some reminder to add the event again after any Mantis core update. Thanks.

zrybola

zrybola

2013-08-06 04:35

reporter   ~0037624

The problem has been solved by editing the core code and adding several new events hooked in a plugin.

I suggest closing this ticket. Thank you, cas, for your advice.

dregad

dregad

2013-08-06 16:44

developer   ~0037639

Assuming you eventually want your plugin to become public (mantisbt-plugins github repo), I suggest you post a git patch of core changes you made, so we can evaluate whether it can be included in a future release