View Issue Details

IDProjectCategoryView StatusLast Update
0008497mantisbtfeaturepublic2016-03-23 08:39
ReporterNycto Assigned To 
PrioritynormalSeverityfeatureReproducibilityN/A
Status confirmedResolutionopen 
Product Version1.1.0rc1 
Summary0008497: Email when Moved
Description

I needed an email notification to be sent when a bug is moved from one project to another.

Details about our practical application:
To make sure bugs go through the right people, we had to tighten down the mantis work flow. The way things are setup, it is the responsibility of a project specific Manager to assign a bug to a developer on creation. If the bug is put in the wrong project by the reporter, the Manager must move to the appropriate place. To make sure the bug didn't get lost at this point, I extended the email notification code to add an "Email when Moved" option so the new Manager would be notified of the new bug.

Additional Information

The patch was tested on CVS HEAD and 1.1.0rc1.

I have attached a diff file that applies the needed changes. The following files are are affected by this patch:
account_prefs_inc.php
account_prefs_update.php
bug_actiongroup.php
config_defaults_inc.php
manage_config_email_page.php
manage_config_email_set.php
core/bug_api.php
core/email_api.php
core/user_pref_api.php
lang/strings_english.txt

For everything to work correctly, this SQL statement must also be run:

ALTER TABLE mantis_user_pref_table
ADD email_on_moved TINYINT( 4 ) NOT NULL DEFAULT '0' AFTER email_on_priority,
ADD email_on_moved_min_severity SMALLINT( 6 ) NOT NULL DEFAULT '10' AFTER email_on_moved

TagsNo tags attached.

Relationships

has duplicate 0013631 closedatrol No mail when moving a ticket from a project to another project 
has duplicate 0020745 closedatrol Add NotificationEvent for Move button . 
related to 0008483 confirmed No email notification to reporter when issue is moved to another project 

Activities

2007-10-22 15:10

 

emailWhenMoved.diff (4,516 bytes)   
? MantisCVS.kpf
? changes.sql
? emailWhenMoved.diff
? log.txt
? test.php
Index: account_prefs_inc.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/account_prefs_inc.php,v
retrieving revision 1.34
diff -b -r1.34 account_prefs_inc.php
250a251,264
> 		<?php echo lang_get( 'email_on_moved' ) ?>
> 	</td>
> 	<td>
> 		<input type="checkbox" name="email_on_moved" <?php check_checked( $t_pref->email_on_moved, ON ); ?> />
> 		<?php echo lang_get( 'with_minimum_severity' ) ?>
> 		<select name="email_on_moved_min_severity">
> 			<option value="<?php echo OFF ?>"><?php echo lang_get( 'any' ) ?></option>
> 			<option value="<?php echo OFF ?>"></option>
> 			<?php print_enum_string_option_list( 'severity', $t_pref->email_on_moved_min_severity ) ?>
> 		</select>
> 	</td>
> </tr>
> <tr class="row-2">
> 	<td class="category">
278c292
< <tr class="row-2">
---
> <tr class="row-1">
Index: account_prefs_update.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/account_prefs_update.php,v
retrieving revision 1.36
diff -b -r1.36 account_prefs_update.php
59a60
> 	$t_prefs->email_on_moved	= gpc_get_bool( 'email_on_moved' );
68a70
> 	$t_prefs->email_on_moved_min_severity		= gpc_get_int( 'email_on_moved_min_severity' );
Index: bug_actiongroup.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/bug_actiongroup.php,v
retrieving revision 1.52
diff -b -r1.52 bug_actiongroup.php
90,91c90
< 				bug_set_field( $t_bug_id, 'project_id', $f_project_id );
< 				helper_call_custom_function( 'issue_update_notify', array( $t_bug_id ) );
---
> 				bug_move( $t_bug_id, $f_project_id );
Index: config_defaults_inc.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/config_defaults_inc.php,v
retrieving revision 1.365
diff -b -r1.365 config_defaults_inc.php
681a682
> 	$g_default_email_on_moved		= OFF;
690a692
> 	$g_default_email_on_moved_minimum_severity		= OFF;
Index: manage_config_email_page.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/manage_config_email_page.php,v
retrieving revision 1.10
diff -b -r1.10 manage_config_email_page.php
245a246
> 		get_capability_row_for_email( lang_get( 'email_on_moved' ), 'moved' );
Index: manage_config_email_set.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/manage_config_email_set.php,v
retrieving revision 1.10
diff -b -r1.10 manage_config_email_set.php
38c38
< 	$t_valid_actions = array( 'owner', 'reopened', 'deleted', 'bugnote' );
---
> 	$t_valid_actions = array( 'owner', 'moved', 'reopened', 'deleted', 'bugnote' );
Index: core/bug_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/bug_api.php,v
retrieving revision 1.111
diff -b -r1.111 bug_api.php
917a918,925
> 	# --------------------
> 	# Moves a bug with the given id to the defined project
> 	function bug_move ( $p_bug_id, $p_project_id ) {
> 		bug_set_field( $p_bug_id, 'project_id', $p_project_id );
> 		email_moved( $p_bug_id );
> 		return true;
> 	}
> 
Index: core/email_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/email_api.php,v
retrieving revision 1.139
diff -b -r1.139 email_api.php
616a617,621
> 	# send notices when a bug is moved
> 	function email_moved( $p_bug_id ) {
> 		email_generic( $p_bug_id, 'moved', 'email_notification_title_for_action_bug_moved' );
> 	}
> 	# --------------------
Index: core/user_pref_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/user_pref_api.php,v
retrieving revision 1.32
diff -b -r1.32 user_pref_api.php
30a31
> 		'email_on_moved' => 'default_email_on_moved',
39a41
> 		'email_on_moved_min_severity' => 'default_email_on_moved_minimum_severity',
64a67
> 		var $email_on_moved = NULL;
73a77
> 		var $email_on_moved_min_severity = NULL;
Index: lang/strings_english.txt
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/lang/strings_english.txt,v
retrieving revision 1.316
diff -b -r1.316 strings_english.txt
347a348
> $s_email_notification_title_for_action_bug_moved = 'The following issue has been MOVED.';
420a422
> $s_email_on_moved = 'Email when Moved';
emailWhenMoved.diff (4,516 bytes)   
vboctor

vboctor

2007-10-24 02:32

manager   ~0015963

I haven't reviewed the implementation, however, I agree with this feature and it was previously requested by users. I've targeted this issue to Mantis 1.2.0.

atrol

atrol

2014-01-21 16:18

developer   ~0039123

Unassigned after having been assigned for a long time without progress.

AlexeiK

AlexeiK

2016-03-23 06:56

reporter   ~0052843

why this code not in main branch?
1.3.0-rc.2-dev master-9d8d010

atrol

atrol

2016-03-23 08:39

developer   ~0052844

why this code not in main branch?

Because no one took the time to

  • review th proposal
  • make required changes
  • document
  • test
    ...

If you are interested in this feature:

Submitting a patch is always a good idea, as it increases the chances of improvement eventually making it into MantisBT core. All contributions are welcome and greatly appreciated.

Patch submissions can be made in several ways. In the order of preference:

  1. Send us a Pull Request on our Github repository [1]
  2. Attach a GIT patch to the issue
  3. Attach a Unified Diff, clearly specifying the patch's base release

Kindly avoid to upload entire modified PHP files.

Please make sure that your submissions adhere to our Coding Guidelines [2], if they don't your patch might be rejected.

[1] https://github.com/mantisbt/mantisbt
[2] http://www.mantisbt.org/wiki/doku.php/mantisbt:coding_guidelines

Issue History

Date Modified Username Field Change
2007-10-22 15:10 Nycto New Issue
2007-10-22 15:10 Nycto File Added: emailWhenMoved.diff
2007-10-24 02:32 vboctor Note Added: 0015963
2007-10-24 02:32 vboctor Status new => acknowledged
2007-10-24 02:32 vboctor Target Version => 1.2.0
2008-07-12 18:19 giallu Target Version => 1.2.0
2008-11-30 17:05 grangeway Status acknowledged => assigned
2008-11-30 17:05 grangeway Assigned To => grangeway
2009-05-04 14:27 siebrand Target Version 1.2.2 => 1.x.x
2011-12-01 04:00 atrol Relationship added has duplicate 0013631
2011-12-01 04:01 atrol Relationship added related to 0008483
2014-01-21 16:18 atrol Note Added: 0039123
2014-01-21 16:19 atrol Status assigned => confirmed
2014-01-21 16:19 atrol Target Version 1.3.0-beta.1 =>
2014-01-21 16:19 atrol Assigned To grangeway =>
2016-03-23 06:41 atrol Relationship added has duplicate 0020745
2016-03-23 06:56 AlexeiK Note Added: 0052843
2016-03-23 08:39 atrol Note Added: 0052844