View Issue Details

IDProjectCategoryView StatusLast Update
0013179mantisbtplug-inspublic2014-02-01 17:42
Reportersagrawal Assigned To 
PrioritynormalSeverityfeatureReproducibilityalways
Status newResolutionopen 
Product Version1.2.5 
Summary0013179: A new event EVENT_COPY_BUG should be added for plugin to do some extra work
Description

We needed to do something more when a bug is copied using feature 'Copy Bug'.
This can be useful to other users also who want to catch an event after bug is copied.

Additional Information

We have created a patch for this (attached with the issue). It might be useful to other users in the community.

Tagspatch
Attached Files
bug_copy_event.patch (1,174 bytes)   
diff -Naur mantisbt-1.2.5/core/bug_api.php mantisbt-1.2.5-patch/core/bug_api.php
--- mantisbt-1.2.5/core/bug_api.php	2011-04-05 23:54:17.000000000 +0530
+++ mantisbt-1.2.5-patch/core/bug_api.php	2011-07-18 18:10:49.000000000 +0530
@@ -1068,6 +1068,9 @@
 			db_query_bound( $query, Array( $t_bug_history['user_id'], $t_new_bug_id, $t_bug_history['date_modified'], $t_bug_history['field_name'], $t_bug_history['old_value'], $t_bug_history['new_value'], $t_bug_history['type'] ) );
 		}
 	}
+	
+	//Let plugins to process after bug is copied.
+	event_signal( 'EVENT_COPY_BUG', array( $t_bug_id, $t_new_bug_id ) );
 
 	return $t_new_bug_id;
 }
diff -Naur mantisbt-1.2.5/core/events_inc.php mantisbt-1.2.5-patch/core/events_inc.php
--- mantisbt-1.2.5/core/events_inc.php	2011-04-05 23:54:17.000000000 +0530
+++ mantisbt-1.2.5-patch/core/events_inc.php	2011-07-18 18:10:42.000000000 +0530
@@ -79,6 +79,9 @@
 	'EVENT_REPORT_BUG_DATA' => EVENT_TYPE_CHAIN,
 	'EVENT_REPORT_BUG' => EVENT_TYPE_EXECUTE,
 
+	# Bug copy event
+	'EVENT_COPY_BUG' => EVENT_TYPE_EXECUTE,
+
 	# Bug view events
 	'EVENT_VIEW_BUG_DETAILS' => EVENT_TYPE_EXECUTE,
 	'EVENT_VIEW_BUG_EXTRA' => EVENT_TYPE_EXECUTE,
bug_copy_event.patch (1,174 bytes)   

Activities