Skip to content

Commit

Permalink
Issue #10906: Add BUGNOTE_DATA event so plugins can preprocess bugnot…
Browse files Browse the repository at this point in the history
…e content

There is an event (REPORT_BUG_DATA) that allows plugins to preprocess
bug data when a bug is submitted. It would be nice if the same type of
event existed for bugnotes.

Signed-off-by: David Hicks <hickseydr@optusnet.com.au>
  • Loading branch information
Chris Fitch authored and davidhicks committed Sep 22, 2009
1 parent ca9b4de commit bef2c84
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
9 changes: 7 additions & 2 deletions core/bugnote_api.php
Expand Up @@ -145,9 +145,14 @@ function bugnote_add( $p_bug_id, $p_bugnote_text, $p_time_tracking = '0:00', $p_
return false;
}

$t_bugnote_text = $p_bugnote_text;

# Event integration
$t_bugnote_text = event_signal( 'EVENT_BUGNOTE_DATA', $t_bugnote_text );

# insert bugnote text
$query = 'INSERT INTO ' . $t_bugnote_text_table . ' ( note ) VALUES ( ' . db_param() . ' )';
db_query_bound( $query, Array( $p_bugnote_text ) );
db_query_bound( $query, Array( $t_bugnote_text ) );

# retrieve bugnote text id number
$t_bugnote_text_id = db_insert_id( $t_bugnote_text_table );
Expand Down Expand Up @@ -187,7 +192,7 @@ function bugnote_add( $p_bug_id, $p_bugnote_text, $p_time_tracking = '0:00', $p_
event_signal( 'EVENT_BUGNOTE_ADD', array( $p_bug_id, $t_bugnote_id ) );

# only send email if the text is not blank, otherwise, it is just recording of time without a comment.
if( TRUE == $p_send_email && !is_blank( $p_bugnote_text ) ) {
if( TRUE == $p_send_email && !is_blank( $t_bugnote_text ) ) {
email_bugnote_add( $p_bug_id );
}

Expand Down
1 change: 1 addition & 0 deletions core/events_inc.php
Expand Up @@ -98,6 +98,7 @@
# Bugnote events
'EVENT_BUGNOTE_ADD_FORM' => EVENT_TYPE_EXECUTE,
'EVENT_BUGNOTE_ADD' => EVENT_TYPE_EXECUTE,
'EVENT_BUGNOTE_DATA' => EVENT_TYPE_CHAIN,
'EVENT_BUGNOTE_EDIT_FORM' => EVENT_TYPE_EXECUTE,
'EVENT_BUGNOTE_EDIT' => EVENT_TYPE_EXECUTE,
'EVENT_BUGNOTE_DELETED' => EVENT_TYPE_EXECUTE,
Expand Down

0 comments on commit bef2c84

Please sign in to comment.