View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0014897 | mantisbt | plug-ins | public | 2012-11-01 19:23 | 2016-07-11 15:45 |
Reporter | rct | Assigned To | |||
Priority | normal | Severity | feature | Reproducibility | always |
Status | acknowledged | Resolution | open | ||
Product Version | 1.2.11 | ||||
Summary | 0014897: Plugins events features request | ||||
Description | Hello, I'm trying to update my plugin (http://www.mantisbt.org/forums/viewtopic.php?f=4&t=20021) to check for version, target version and fixed in version. Explanations :
It will be nice if those features will be added in a future release :) | ||||
Tags | No tags attached. | ||||
Attached Files | patch.diff (9,228 bytes)
diff --git a/bug_actiongroup.php b/bug_actiongroup.php index 5c04727..89edd48 100644 --- a/bug_actiongroup.php +++ b/bug_actiongroup.php @@ -75,8 +75,12 @@ if ( access_can_close_bug( $t_bug ) ) { if( ( $t_status < $t_closed ) && bug_check_workflow( $t_status, $t_closed ) ) { - /** @todo we need to issue a helper_call_custom_function( 'issue_update_validate', array( $f_bug_id, $t_bug_data, $f_bugnote_text ) ); */ + # Plugin support + $t_new_bug_data = event_signal( 'EVENT_UPDATE_BUG', $t_bug, $t_bug_id ); + if ( !is_null( $t_new_bug_data ) ) { + $t_bug = $t_new_bug_data; + } bug_close( $t_bug_id, $f_bug_notetext, $f_bug_noteprivate ); helper_call_custom_function( 'issue_update_notify', array( $t_bug_id ) ); } else { @@ -101,6 +105,11 @@ if( access_has_bug_level( config_get( 'move_bug_threshold' ), $t_bug_id ) && access_has_project_level( config_get( 'report_bug_threshold', null, null, $f_project_id ), $f_project_id ) ) { /** @todo we need to issue a helper_call_custom_function( 'issue_update_validate', array( $t_bug_id, $t_bug_data, $f_bugnote_text ) ); */ + # Plugin support + $t_new_bug_data = event_signal( 'EVENT_UPDATE_BUG', $t_bug, $t_bug_id ); + if ( !is_null( $t_new_bug_data ) ) { + $t_bug = $t_new_bug_data; + } bug_move( $t_bug_id, $f_project_id ); helper_call_custom_function( 'issue_update_notify', array( $t_bug_id ) ); } else { @@ -133,6 +142,11 @@ if ( access_has_bug_level( config_get( 'handle_bug_threshold' ), $t_bug_id, $f_assign ) ) { if ( bug_check_workflow( $t_status, $t_assign_status ) ) { /** @todo we need to issue a helper_call_custom_function( 'issue_update_validate', array( $t_bug_id, $t_bug_data, $f_bugnote_text ) ); */ + # Plugin support + $t_new_bug_data = event_signal( 'EVENT_UPDATE_BUG', $t_bug, $t_bug_id ); + if ( !is_null( $t_new_bug_data ) ) { + $t_bug = $t_new_bug_data; + } bug_assign( $t_bug_id, $f_assign, $f_bug_notetext, $f_bug_noteprivate ); helper_call_custom_function( 'issue_update_notify', array( $t_bug_id ) ); } else { @@ -153,7 +167,17 @@ bug_check_workflow($t_status, $t_resolved_status ) ) { $f_resolution = gpc_get_int( 'resolution' ); $f_fixed_in_version = gpc_get_string( 'fixed_in_version', '' ); + # Plugin support + $t_new_bug_data = event_signal( 'EVENT_UPDATE_BUG', $t_bug, $t_bug_id ); + if ( !is_null( $t_new_bug_data ) ) { + $t_bug = $t_new_bug_data; + } /** @todo we need to issue a helper_call_custom_function( 'issue_update_validate', array( $t_bug_id, $t_bug_data, $f_bugnote_text ) ); */ + # Plugin support + $t_new_bug_data = event_signal( 'EVENT_UPDATE_BUG', $t_bug, $t_bug_id ); + if ( !is_null( $t_new_bug_data ) ) { + $t_bug = $t_new_bug_data; + } bug_resolve( $t_bug_id, $f_resolution, null, $f_fixed_in_version, null, null, $f_bug_notetext, $f_bug_noteprivate ); helper_call_custom_function( 'issue_update_notify', array( $t_bug_id ) ); } else { @@ -168,6 +192,11 @@ if ( access_has_bug_level( config_get( 'update_bug_threshold' ), $t_bug_id ) ) { $f_priority = gpc_get_int( 'priority' ); /** @todo we need to issue a helper_call_custom_function( 'issue_update_validate', array( $t_bug_id, $t_bug_data, $f_bugnote_text ) ); */ + # Plugin support + $t_new_bug_data = event_signal( 'EVENT_UPDATE_BUG', $t_bug, $t_bug_id ); + if ( !is_null( $t_new_bug_data ) ) { + $t_bug = $t_new_bug_data; + } bug_set_field( $t_bug_id, 'priority', $f_priority ); helper_call_custom_function( 'issue_update_notify', array( $t_bug_id ) ); } else { @@ -181,6 +210,11 @@ if ( access_has_bug_level( access_get_status_threshold( $f_status, $t_project ), $t_bug_id ) ) { if ( TRUE == bug_check_workflow($t_status, $f_status ) ) { /** @todo we need to issue a helper_call_custom_function( 'issue_update_validate', array( $t_bug_id, $t_bug_data, $f_bugnote_text ) ); */ + # Plugin support + $t_new_bug_data = event_signal( 'EVENT_UPDATE_BUG', $t_bug, $t_bug_id ); + if ( !is_null( $t_new_bug_data ) ) { + $t_bug = $t_new_bug_data; + } bug_set_field( $t_bug_id, 'status', $f_status ); # Add bugnote if supplied @@ -202,6 +236,11 @@ if ( access_has_bug_level( config_get( 'update_bug_threshold' ), $t_bug_id ) ) { if ( category_exists( $f_category_id ) ) { /** @todo we need to issue a helper_call_custom_function( 'issue_update_validate', array( $t_bug_id, $t_bug_data, $f_bugnote_text ) ); */ + # Plugin support + $t_new_bug_data = event_signal( 'EVENT_UPDATE_BUG', $t_bug, $t_bug_id ); + if ( !is_null( $t_new_bug_data ) ) { + $t_bug = $t_new_bug_data; + } bug_set_field( $t_bug_id, 'category_id', $f_category_id ); helper_call_custom_function( 'issue_update_notify', array( $t_bug_id ) ); } else { @@ -219,6 +258,11 @@ if ( access_has_bug_level( config_get( 'update_bug_threshold' ), $t_bug_id ) ) { if ( $f_fixed_in_version === '' || version_get_id( $f_fixed_in_version, $t_project_id ) !== false ) { /** @todo we need to issue a helper_call_custom_function( 'issue_update_validate', array( $t_bug_id, $t_bug_data, $f_bugnote_text ) ); */ + # Plugin support + $t_new_bug_data = event_signal( 'EVENT_UPDATE_BUG', $t_bug, $t_bug_id ); + if ( !is_null( $t_new_bug_data ) ) { + $t_bug = $t_new_bug_data; + } bug_set_field( $t_bug_id, 'fixed_in_version', $f_fixed_in_version ); helper_call_custom_function( 'issue_update_notify', array( $t_bug_id ) ); } else { @@ -236,6 +280,11 @@ if ( access_has_bug_level( config_get( 'roadmap_update_threshold' ), $t_bug_id ) ) { if ( $f_target_version === '' || version_get_id( $f_target_version, $t_project_id ) !== false ) { /** @todo we need to issue a helper_call_custom_function( 'issue_update_validate', array( $t_bug_id, $t_bug_data, $f_bugnote_text ) ); */ + # Plugin support + $t_new_bug_data = event_signal( 'EVENT_UPDATE_BUG', $t_bug, $t_bug_id ); + if ( !is_null( $t_new_bug_data ) ) { + $t_bug = $t_new_bug_data; + } bug_set_field( $t_bug_id, 'target_version', $f_target_version ); helper_call_custom_function( 'issue_update_notify', array( $t_bug_id ) ); } else { @@ -250,6 +299,11 @@ if ( access_has_bug_level( config_get( 'change_view_status_threshold' ), $t_bug_id ) ) { $f_view_status = gpc_get_int( 'view_status' ); /** @todo we need to issue a helper_call_custom_function( 'issue_update_validate', array( $t_bug_id, $t_bug_data, $f_bugnote_text ) ); */ + # Plugin support + $t_new_bug_data = event_signal( 'EVENT_UPDATE_BUG', $t_bug, $t_bug_id ); + if ( !is_null( $t_new_bug_data ) ) { + $t_bug = $t_new_bug_data; + } bug_set_field( $t_bug_id, 'view_state', $f_view_status ); helper_call_custom_function( 'issue_update_notify', array( $t_bug_id ) ); } else { @@ -262,6 +316,11 @@ $f_sticky = bug_get_field( $t_bug_id, 'sticky' ); // The new value is the inverted old value /** @todo we need to issue a helper_call_custom_function( 'issue_update_validate', array( $t_bug_id, $t_bug_data, $f_bugnote_text ) ); */ + # Plugin support + $t_new_bug_data = event_signal( 'EVENT_UPDATE_BUG', $t_bug, $t_bug_id ); + if ( !is_null( $t_new_bug_data ) ) { + $t_bug = $t_new_bug_data; + } bug_set_field( $t_bug_id, 'sticky', intval( !$f_sticky ) ); helper_call_custom_function( 'issue_update_notify', array( $t_bug_id ) ); } else { @@ -275,6 +334,11 @@ } /** @todo we need to issue a helper_call_custom_function( 'issue_update_validate', array( $t_bug_id, $t_bug_data, $f_bugnote_text ) ); */ + # Plugin support + $t_new_bug_data = event_signal( 'EVENT_UPDATE_BUG', $t_bug, $t_bug_id ); + if ( !is_null( $t_new_bug_data ) ) { + $t_bug = $t_new_bug_data; + } $t_form_var = "custom_field_$f_custom_field_id"; $t_custom_field_value = gpc_get_custom_field( $t_form_var, $t_custom_field_def['type'], null ); custom_field_set_value( $f_custom_field_id, $t_bug_id, $t_custom_field_value ); diff --git a/bug_update.php b/bug_update.php index bfdebb8..911cbdd 100644 --- a/bug_update.php +++ b/bug_update.php @@ -166,6 +166,13 @@ trigger_error( ERROR_CUSTOM_FIELD_INVALID_VALUE, ERROR ); } } + + + # Plugin support + $t_new_bug_data = event_signal( 'EVENT_UPDATE_BUG', $t_bug_data, $f_bug_id ); + if ( !is_null( $t_new_bug_data ) ) { + $t_bug_data = $t_new_bug_data; + } $t_notify = true; $t_bug_note_set = false; @@ -213,12 +220,6 @@ $t_bug_data->status = bug_get_field( $f_bug_id, 'status' ); $t_bug_data->resolution = bug_get_field( $f_bug_id, 'resolution' ); } - } - - # Plugin support - $t_new_bug_data = event_signal( 'EVENT_UPDATE_BUG', $t_bug_data, $f_bug_id ); - if ( !is_null( $t_new_bug_data ) ) { - $t_bug_data = $t_new_bug_data; } # Add a bugnote if there is one | ||||
So is this on the todo list, to ensure that events (like mentioned above)are defined consistently? |
|
I haven't tested but as I can see in the code it seems in the code that Atrol has resolved the bug (see 0015559). Thanks |
|
rct, what are you talking about ? 0015559 does not contain any patch, atrol just marked it as duplicate of this. And as far as I can see, there are no new events hooks defined in the code. You're still welcome to provide a patch for this. Note for future development - there are additional details in 0015559 |
|
Right no code has been modified. |
|
I'm not familiar with GIT nor all the pull request and other stuff. |
|
I've added a pull request for this : https://github.com/mantisbt/mantisbt/pull/83 |
|
Thanks, I'll review as time allows. |
|
Nice :) |
|
Any news for this? |
|
Any news for this ? |
|