View Issue Details

IDProjectCategoryView StatusLast Update
0009309mantisbtemailpublic2023-06-06 11:48
ReporterOlegD Assigned Togiallu  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Platformi386OSLinuxOS Version2.6.23
Product Version1.1.2 
Target Version1.1.3Fixed in Version1.1.3 
Summary0009309: Problems with e-mail notifications about bugnotes [PATCH]
Description

Mantis 2.6.23 never sends e-mail notifications about new bugnotes. This happens because of improper checking of uninitialized variable $p_send_email in bugnote_add(). Attached patch fixes this.

Steps To Reproduce
  1. Create new bug report;
  2. Assign it to some user/create bug monitor regarding this bug for some user;
  3. Add note for a bug;
  4. No e-mail will be sent to user.
Tagspatch
Attached Files
bugnote_api.php.patch (794 bytes)   
*** bugnote_api.php.orig	Sat May 31 00:53:29 2008
--- bugnote_api.php	Sat Jun 28 01:11:45 2008
***************
*** 164,170 ****
  		history_log_event_special( $p_bug_id, BUGNOTE_ADDED, bugnote_format_id( $t_bugnote_id ) );
  
  		# only send email if the text is not blank, otherwise, it is just recording of time without a comment.
! 		if ( $p_send_email && !is_blank( $p_bugnote_text ) ) {
  			email_bugnote_add( $p_bug_id );
  		}
  		return $t_bugnote_id;
--- 164,170 ----
  		history_log_event_special( $p_bug_id, BUGNOTE_ADDED, bugnote_format_id( $t_bugnote_id ) );
  
  		# only send email if the text is not blank, otherwise, it is just recording of time without a comment.
! 		if ( !is_blank( $p_bugnote_text ) ) {
  			email_bugnote_add( $p_bug_id );
  		}
  		return $t_bugnote_id;
bugnote_api.php.patch (794 bytes)   
correct_bugnote_api.php.patch (971 bytes)   
*** bugnote_api.php.orig	Sat May 31 00:53:29 2008
--- bugnote_api.php	Sat Jun 28 20:32:03 2008
***************
*** 99,105 ****
  	# Add a bugnote to a bug
  	#
  	# return the ID of the new bugnote
! 	function bugnote_add ( $p_bug_id, $p_bugnote_text, $p_time_tracking = '0:00', $p_private = false, $p_type = 0, $p_attr = '', $p_user_id = null ) {
  		$c_bug_id            	= db_prepare_int( $p_bug_id );
  		$c_bugnote_text      	= db_prepare_string( $p_bugnote_text );
  		$c_time_tracking	= db_prepare_time( $p_time_tracking );
--- 99,105 ----
  	# Add a bugnote to a bug
  	#
  	# return the ID of the new bugnote
! 	function bugnote_add ( $p_bug_id, $p_bugnote_text, $p_time_tracking = '0:00', $p_private = false, $p_type = 0, $p_attr = '', $p_user_id = null, $p_send_email=TRUE ) {
  		$c_bug_id            	= db_prepare_int( $p_bug_id );
  		$c_bugnote_text      	= db_prepare_string( $p_bugnote_text );
  		$c_time_tracking	= db_prepare_time( $p_time_tracking );

Relationships

has duplicate 0009305 closedgiallu Update from 1.1.1 to 1.1.2 caused email notifications to stop 
has duplicate 0009327 closedgiallu After enable email notify, all user can't recieve the notify email of "note add". 
has duplicate 0009457 closedgiallu cant get Mantis to send note added notification emails 
related to 0009496 closeddregad Can not receive email when a new issue is added 

Activities

grangeway

grangeway

2008-06-28 08:52

reporter   ~0018217

Oleg,

The function definition sets p_send_email:

function bugnote_add( $p_bug_id, $p_bugnote_text, $p_time_tracking = '0:00', $p_private = false, $p_type = 0, $p_attr = '', $p_user_id = null, $p_send_email=TRUE ) {

I know in my various versions I get email notifications on adding bugnotes, so I suspect something else might be at fault or there's a bug elsewhere, but as you can see p_send_email is defined.

Paul

OlegD

OlegD

2008-06-28 09:57

reporter   ~0018219

There is no p_send_email parameter in function definition in Mantis 1.1.2:

function bugnote_add ( $p_bug_id, $p_bugnote_text, $p_time_tracking = '0:00', $p_private = false, $p_type = 0, $p_attr = '', $p_user_id = null ) {
[...]
}

I don't know where you get your definition. My definition is from core/bugnote_api.php from mantis-1.1.2.tar.gz (latest stable version available from your site).

blueray

blueray

2008-06-28 12:19

reporter   ~0018220

Hi,

I'am confuse too.
I found that the $p_send_email=TRUE was in the trunk but no other.

The $p_send_email=TRUE
and the code block

    # only send email if the text is not blank, otherwise, it is just recording of time without a comment.

! if ( !is_blank( $p_bugnote_text ) ) {
email_bugnote_add( $p_bug_id );

was remove.

This is a new change in 1.2.x branches ?

vboctor

vboctor

2008-07-01 01:27

manager   ~0018253

Fixed via svn:5385
http://mantisbt.svn.sourceforge.net/mantisbt/?rev=5385&view=rev

$p_send_email wasn't initialized in 1.1.x branch.

giallu

giallu

2008-07-02 03:16

reporter   ~0018270

/me wonder how this slipped in...

OlegD

OlegD

2008-07-02 05:06

reporter   ~0018277

After further research, I found that in some places where bugnote_add() called (even in 1.1.x branch) the presence of last parameter p_send_email is assumed (for example, such call exists in bug_reminder.php). So, the correct patch should just add this parameter to function definition (with default value TRUE). I will attach this patch later.

OlegD

OlegD

2008-07-02 05:11

reporter   ~0018278

Attached file correct_bugnote_api.php.patch should fix this issue in more reasonable way. This patch is against original version from .tar.gz, not against current SVN snapshot.

jaiger

jaiger

2008-07-10 16:54

reporter   ~0018361

The change made in correct_bugnote_api.php.patch seems to resolve the problems for me. I'm using 1.1.2 tarball.

Thanks!

-Joe

giallu

giallu

2008-07-12 18:30

reporter   ~0018381

ok, I ported the relevant code from trunk.

It would be nice if someone could test the BRANCH_1_1_X code to double check the fix.

giallu

giallu

2008-07-12 18:38

reporter   ~0018382

Diff here:
http://mantisbt.svn.sourceforge.net/mantisbt/?rev=5407&view=rev

giallu

giallu

2008-07-14 09:41

reporter   ~0018511

This is the same diff, but against 1.1.2:

http://mantisbt.svn.sourceforge.net/viewvc/mantisbt/branches/BRANCH_1_1_0/mantisbt/core/bugnote_api.php?r1=5370&r2=5407

Extend

Extend

2008-09-22 18:13

reporter   ~0019425

how can i apply this patch i just upgraded from an earlier version i found different settings for the email notification i want someone to provide me how to configure notification to be sent when assigned a bug to someone or add a note to developer who maintaining this bug only, i tried to customize email notifications from the mantis web interface but there are a lot of conflicts.

Related Changesets

MantisBT: master-1.1.x b76e4818

2008-07-12 18:23

giallu


Details Diff
Fix 9309: Problems with e-mail notifications about bugnotes.

git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/branches/BRANCH_1_1_0@5407 <a class="text" href="/?p=mantisbt.git;a=object;h=f5dc347c">f5dc347c</a>-c33d-0410-90a0-b07cc1902cb9
Affected Issues
0009309
mod - core/bugnote_api.php Diff File