From 43ab44364c4d0caae17bde696730119e4f655a1a Mon Sep 17 00:00:00 2001
From: Chris Fitch <cfitch@redcom.com>
Date: Fri, 4 Sep 2009 08:56:31 -0400
Subject: [PATCH] Move BUGNOTE_ADD event to bugnote_add() function


diff --git a/bugnote_add.php b/bugnote_add.php
index d579232..ba8be0e 100644
--- a/bugnote_add.php
+++ b/bugnote_add.php
@@ -59,9 +59,6 @@
         trigger_error( ERROR_EMPTY_FIELD, ERROR );
     }
 
-	# Event integration
-	event_signal( 'EVENT_BUGNOTE_ADD', array( $f_bug_id, $t_bugnote_id ) );
-
 	form_security_purge( 'bugnote_add' );
 
 	print_successful_redirect_to_bug( $f_bug_id );
diff --git a/core/bugnote_api.php b/core/bugnote_api.php
index 3f0f0c9..ebc70b4 100644
--- a/core/bugnote_api.php
+++ b/core/bugnote_api.php
@@ -183,6 +183,9 @@ function bugnote_add( $p_bug_id, $p_bugnote_text, $p_time_tracking = '0:00', $p_
 	# log new bug
 	history_log_event_special( $p_bug_id, BUGNOTE_ADDED, bugnote_format_id( $t_bugnote_id ) );
 
+	# Event integration
+	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 ) ) {
 		email_bugnote_add( $p_bug_id );
-- 
1.6.0.4

