View Issue Details

IDProjectCategoryView StatusLast Update
0008849mantisbttime trackingpublic2008-08-11 09:41
Reporterkynx Assigned Todaryn  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
PlatformLinuxOSRHELOS Version5
Product Version1.1.1 
Fixed in Version1.2.0a2 
Summary0008849: Emails ignore time tracking view threshold
Description

The emailing script contains time tracking information, even if the user they are sent to is below the timetracking view threshold.

I notice that the check for the threshold is being made in bugnote_get_all_visible_bugnotes(), but then ignored email_format_bug_message(). The attached patch (against 1.1.1) corrects that.

TagsNo tags attached.
Attached Files
email_timetracking.diff (904 bytes)   
diff -ru mantis-1.1.1.orig/core/email_api.php mantis-1.1.1/core/email_api.php
--- mantis-1.1.1.orig/core/email_api.php	2008-01-19 07:43:47.000000000 +0000
+++ mantis-1.1.1/core/email_api.php	2008-02-01 12:45:56.000000000 +0000
@@ -1056,9 +1056,8 @@
 			$t_formatted_bugnote_id = bugnote_format_id( $t_bugnote->id );
 			$t_bugnote_link = string_process_bugnote_link ( config_get( 'bugnote_link_tag' ) . $t_bugnote->id, false, false, true );
 
-			$t_time_tracking_minutes = bugnote_get_field ( $t_bugnote->id, 'time_tracking' );
-			if ( $t_time_tracking_minutes > 0 ) {
-				$t_time_tracking = ' ' . lang_get( 'time_tracking' ) . ' ' . db_minutes_to_hhmm( $t_time_tracking_minutes ) . "\n";
+			if ( $t_bugnote->time_tracking > 0 ) {
+				$t_time_tracking = ' ' . lang_get( 'time_tracking' ) . ' ' . db_minutes_to_hhmm( $t_bugnote->time_tracking ) . "\n";
 			} else {
 				$t_time_tracking = '';
 			}
email_timetracking.diff (904 bytes)   

Relationships

parent of 0009184 closedvboctor Port 0008849: Emails ignore time tracking view threshold 

Activities

daryn

daryn

2008-04-21 10:55

reporter   ~0017639

Looked over changes in patch. Looks good so applied to trunk.

lolotrav

lolotrav

2008-05-05 09:25

reporter   ~0017775

Last edited: 2008-05-05 09:25

Hum, this patch does does not work here (mantis 1.1.1), and probably
also not in trunk.

In case user hasn't enough rights to see time tracking info, $t_bugnote->time_tracking is set to 0 (bugnote_api.php, L283)
thus the patch test is correct.

However, if the user has enough rights, the problem is that $t_bugnote->time_tracking is already formatted as hh:mm
(same file, L356).
Thus email contains only time tracking info if time is more than
1 hour, and is wrongly displayed as 00:hh...

I would suggest :

if ( $t_bugnote->time_tracking !== 0 && $t_bugnote->time_tracking != '00:00') {
$t_time_tracking = ' ' . lang_get( 'time_tracking' ) . ' ' . $t_bugnote->time_tracking ) . "\n";
} else {
...

It works, but it does not look very nice.

In any case, I think bug should be reopened.

daryn

daryn

2008-05-06 09:29

reporter   ~0017778

reopening to check note 0008849:0017775.

daryn

daryn

2008-05-29 15:53

reporter   ~0017950

lolotrav can you check this with svn-revision 5303? I think another change slipped in between my original fix and your testing that broke the display and calculation of time tracking. I've removed the extra formatting and it seems to work correctly for me. This only applies to trunk. I did not patch the 1.1.x branch (I think victor did that earlier though). Thanks.

daryn

daryn

2008-05-30 12:14

reporter   ~0017962

This works correctly for me now. I'm looking for confirmation from others, specifically lolotrav, that this is fixed in trunk.

lolotrav

lolotrav

2008-05-31 14:36

reporter   ~0017972

I received your email. Unfortunately I can't test your patch, our Mantis 1.1.1 is now in production.
Looking at your patch, I suppose it solves the problem (provided nobody else expects the ->time_tracking field to be formatted ; who added the call to db_minutes_to_hhmm(), and why ??)

daryn

daryn

2008-06-06 17:27

reporter   ~0018034

I'm going to resolve this as my testing indicates that it is fixed.

lolotrav to present we haven't really supported outside use of the apis other than through the soap interface. All internal calls to this function already format the string as needed so i'm not too worried that someone is expecting a formatted string. I'm not sure when or why the db_minutes_to_hhmm call was added to the bugnotes... function but returning the actual value and allowing the caller to format it is the correct way to do this under the current api. Providing an additional function in the nature of bugnote->time_tracking->to_string is being discussed as a future possibility.

Related Changesets

MantisBT: master e6c44ba1

2008-04-21 10:52

daryn


Details Diff
Apply patch for bug 8849 - Emails ignore time tracking view threshold

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