View Issue Details

IDProjectCategoryView StatusLast Update
0015648mantisbtemailpublic2014-02-07 18:24
ReporterHeikoSL Assigned Todregad  
PrioritynormalSeverityfeatureReproducibilityalways
Status closedResolutionfixed 
Product Version1.2.14 
Target Version1.2.16Fixed in Version1.2.16 
Summary0015648: add event signalling to email_build_subject() function
Description

For customization I need to add event signalling to email_build_subject() function. That will let me use a plugin to customize email subjects.

Additional Information

depends on 0015647 to work properly on all email subjects
related to 0008986

TagsNo tags attached.

Relationships

related to 0008986 new customized eMail subjects 
parent of 0015647 closedatrol email subject is build manually in function email_bug_info_to_one_user() 

Activities

HeikoSL

HeikoSL

2013-03-13 07:29

reporter  

hook_build_subject.patch (1,445 bytes)   
From 0eff23778d515e7b9b7ede523e865aa279474079 Mon Sep 17 00:00:00 2001
From: Heiko Schneider-Lange <heikoschneider@web.de>
Date: Wed, 13 Mar 2013 12:19:09 +0100
Subject: [PATCH] add hook EVENT_DISPLAY_EMAIL_BUILD_SUBJECT for email subject

---
 core/email_api.php  |    7 ++++++-
 core/events_inc.php |    1 +
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/core/email_api.php b/core/email_api.php
index 0c3ac15..154f947 100644
--- a/core/email_api.php
+++ b/core/email_api.php
@@ -1087,7 +1087,12 @@ function email_build_subject( $p_bug_id ) {
 	# padd the bug id with zeros
 	$p_bug_id = bug_format_id( $p_bug_id );
 
-	return '[' . $p_project_name . ' ' . $p_bug_id . ']: ' . $p_subject;
+	$t_email_subject = '[' . $p_project_name . ' ' . $p_bug_id . ']: ' . $p_subject;
+	
+	#update subject as defined by plugins
+	$t_email_subject = event_signal('EVENT_DISPLAY_EMAIL_BUILD_SUBJECT', $t_email_subject, array('bug_id' => $p_bug_id));
+	
+	return $t_email_subject;
 }
 
 /**
diff --git a/core/events_inc.php b/core/events_inc.php
index 5079aa4..1c24d9a 100644
--- a/core/events_inc.php
+++ b/core/events_inc.php
@@ -41,6 +41,7 @@ event_declare_many( array(
 	'EVENT_DISPLAY_FORMATTED' => EVENT_TYPE_CHAIN,
 	'EVENT_DISPLAY_RSS' => EVENT_TYPE_CHAIN,
 	'EVENT_DISPLAY_EMAIL' => EVENT_TYPE_CHAIN,
+	'EVENT_DISPLAY_EMAIL_BUILD_SUBJECT' => EVENT_TYPE_CHAIN,
 
 	# Menu Events
 	'EVENT_MENU_MAIN' => EVENT_TYPE_DEFAULT,
-- 
1.7.2.5

hook_build_subject.patch (1,445 bytes)   
HeikoSL

HeikoSL

2013-03-13 11:04

reporter   ~0035855

https://github.com/mantisbt/mantisbt/pull/77

HeikoSL

HeikoSL

2013-03-15 05:28

reporter   ~0035872

for whom it may concern:
the plugin that depends on this entry can be found in https://github.com/langerheiko/CustomizeEmailSubject_for_MantisBT

dregad

dregad

2013-04-20 12:40

developer   ~0036634

Forked in mantibt-plugins organization - https://github.com/mantisbt-plugins/CustomizeEmailSubject

Related Changesets

MantisBT: master-1.2.x 4090050b

2013-04-19 11:56:19

dregad

Details Diff
Add plugin event for e-mail subject customization

New event: EVENT_DISPLAY_EMAIL_BUILD_SUBJECT

Fixes 0015648
Affected Issues
0015648
mod - core/email_api.php Diff File
mod - core/events_inc.php Diff File

MantisBT: master b292ef1b

2013-04-19 11:56:19

dregad

Details Diff
Add plugin event for e-mail subject customization

New event: EVENT_DISPLAY_EMAIL_BUILD_SUBJECT

Fixes 0015648
Affected Issues
0015648
mod - core/email_api.php Diff File
mod - core/events_inc.php Diff File

Issue History

Date Modified Username Field Change
2013-03-13 07:29 HeikoSL New Issue
2013-03-13 07:29 HeikoSL File Added: hook_build_subject.patch
2013-03-13 09:34 atrol Relationship added parent of 0015647
2013-03-13 09:35 atrol Relationship added related to 0008986
2013-03-13 11:04 HeikoSL Note Added: 0035855
2013-03-15 05:28 HeikoSL Note Added: 0035872
2013-04-19 12:02 dregadmin Changeset attached => MantisBT master b292ef1b
2013-04-19 12:02 dregadmin Assigned To => dregadmin
2013-04-19 12:02 dregadmin Status new => resolved
2013-04-19 12:02 dregadmin Resolution open => fixed
2013-04-19 12:02 dregadmin Fixed in Version => 1.3.0-beta.1
2013-04-19 12:02 dregadmin Changeset attached => MantisBT master-1.2.x 4090050b
2013-04-19 12:25 atrol Fixed in Version 1.3.0-beta.1 => 1.2.16
2013-04-19 12:25 atrol Target Version => 1.2.16
2013-04-20 12:40 dregad Note Added: 0036634
2013-04-21 15:25 atrol Assigned To dregadmin => dregad
2013-04-21 15:25 atrol Status resolved => assigned
2013-04-21 15:25 atrol Status assigned => resolved
2014-02-07 18:24 dregad Status resolved => closed