View Issue Details

IDProjectCategoryView StatusLast Update
0010906mantisbtplug-inspublic2019-08-23 04:33
Reportercmfitch1 Assigned Todhx  
PrioritynormalSeverityfeatureReproducibilityN/A
Status closedResolutionfixed 
Target Version1.2.0rc2Fixed in Version1.2.0rc2 
Summary0010906: Add new event to allow plugins to preprocess bugnote content
Description

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.

Tagspatch
Attached Files
issue_10906.patch (1,911 bytes)   
From 169c2cca0851280a965fd78d10e8f24f48c7b727 Mon Sep 17 00:00:00 2001
From: Chris Fitch <cfitch@redcom.com>
Date: Fri, 4 Sep 2009 09:21:10 -0400
Subject: [PATCH] Add BUGNOTE_DATA event so plugins can preprocess bugnote content


diff --git a/core/bugnote_api.php b/core/bugnote_api.php
index ebc70b4..f60a494 100644
--- a/core/bugnote_api.php
+++ b/core/bugnote_api.php
@@ -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 );
@@ -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 );
 	}
 
diff --git a/core/events_inc.php b/core/events_inc.php
index 226f0f9..3647c72 100644
--- a/core/events_inc.php
+++ b/core/events_inc.php
@@ -98,6 +98,7 @@ event_declare_many( array(
 	# 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,
-- 
1.6.0.4

issue_10906.patch (1,911 bytes)   

Relationships

related to 0011066 closedjreese Add bug_id parameter to EVENT_BUGNOTE_DATA 
related to 0025914 closeddregad EVENT_BUGNOTE_DATA event not documented in developer manual 

Activities

dhx

dhx

2009-09-22 03:27

reporter   ~0023006

Committed, thanks!

Related Changesets

MantisBT: master-1.2.x 4833dba6

2009-09-04 09:21

Chris Fitch

Committer: dhx


Details Diff
Issue 0010906: Add BUGNOTE_DATA event so plugins can preprocess bugnote 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>
Affected Issues
0010906
mod - core/events_inc.php Diff File
mod - core/bugnote_api.php Diff File

MantisBT: master bef2c84b

2009-09-04 09:21

Chris Fitch

Committer: dhx


Details Diff
Issue 0010906: Add BUGNOTE_DATA event so plugins can preprocess bugnote 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>
Affected Issues
0010906
mod - core/events_inc.php Diff File
mod - core/bugnote_api.php Diff File