View Issue Details

IDProjectCategoryView StatusLast Update
0013336mantisbtbugtrackerpublic2012-01-09 10:29
Reportervincent_sels Assigned To 
PrioritynormalSeverityfeatureReproducibilityN/A
Status newResolutionopen 
Product Version1.2.8 
Summary0013336: Add the option to make additional_information only viewable starting from a certain access level
Description

In many tickets, developers want to include some technical info, that is of no use to the reporters but contains valuable information in case another developer continues working on the ticket later on, or simply for future reference.

I don't want to 'pollute' the ticket with this technical information for the reporter. Now, you can post 'private' notes with this kind of information. I would like some kind of more 'integrated' solution for it though. The 'additional information' field looks fine for this. 'Technical information' would make more sense in that case, though.

Tagspatch
Attached Files
0013336.diff (5,368 bytes)   
--- C:/Documents and Settings/vsel/mantisbt-1.2.8/config_defaults_inc.php	Mon Sep 26 21:44:54 2011
+++ C:/Documents and Settings/vsel/mantisbt-edited/config_defaults_inc.php	Mon Sep 26 21:44:21 2011
@@ -2717,6 +2717,12 @@
 	 * @global int $g_set_configuration_threshold
 	 */
 	$g_set_configuration_threshold = ADMINISTRATOR;
+	
+	/**
+	 * threshold for users to view the 'additional information' field.
+	 * @global int $g_view_additional_information_threshold
+	 */
+	$g_view_additional_information_threshold = DEVELOPER;
 
 	/************************************
 	 * MantisBT Look and Feel Variables *
--- C:/Documents and Settings/vsel/mantisbt-1.2.8/bug_view_inc.php	Tue Sep 06 10:23:10 2011
+++ C:/Documents and Settings/vsel/mantisbt-edited/bug_view_inc.php	Thu Sep 22 21:38:20 2011
@@ -152,7 +152,7 @@
 
 	$tpl_show_reporter = in_array( 'reporter', $t_fields );
 	$tpl_show_handler = in_array( 'handler', $t_fields ) && access_has_bug_level( config_get( 'view_handler_threshold' ), $f_bug_id );
-	$tpl_show_additional_information = !is_blank( $tpl_bug->additional_information ) && in_array( 'additional_info', $t_fields );
+	$tpl_show_additional_information = !is_blank( $tpl_bug->additional_information ) && in_array( 'additional_info', $t_fields ) && access_compare_level( access_get_global_level(), config_get( 'view_additional_information_threshold' ) );
 	$tpl_show_steps_to_reproduce = !is_blank( $tpl_bug->steps_to_reproduce ) && in_array( 'steps_to_reproduce', $t_fields );
 	$tpl_show_monitor_box = !$tpl_force_readonly;
 	$tpl_show_relationships_box = !$tpl_force_readonly;
--- C:/Documents and Settings/vsel/mantisbt-1.2.8/print_bug_page.php	Tue Sep 06 10:23:12 2011
+++ C:/Documents and Settings/vsel/mantisbt-edited/print_bug_page.php	Wed Sep 21 18:25:42 2011
@@ -78,7 +78,7 @@
 	$tpl_show_summary = in_array( 'summary', $t_fields );
 	$tpl_show_description = in_array( 'description', $t_fields );
 	$tpl_show_steps_to_reproduce = in_array( 'steps_to_reproduce', $t_fields );
-	$tpl_show_additional_information = in_array( 'additional_info', $t_fields );
+	$tpl_show_additional_information = in_array( 'additional_info', $t_fields ) && access_compare_level( access_get_global_level(), config_get( 'view_additional_information_threshold' ) );
 	$tpl_show_tags = in_array( 'tags', $t_fields );
 	$tpl_show_attachments = in_array( 'attachments', $t_fields );
 	$tpl_show_history = access_has_bug_level( config_get( 'view_history_threshold' ), $f_bug_id );
--- C:/Documents and Settings/vsel/mantisbt-1.2.8/bug_update_advanced_page.php	Tue Sep 06 10:23:10 2011
+++ C:/Documents and Settings/vsel/mantisbt-edited/bug_update_advanced_page.php	Wed Sep 21 18:23:10 2011
@@ -96,7 +96,7 @@
 $tpl_summary_attribute = $tpl_show_summary ? string_attribute( $tpl_bug->summary ) : '';
 $tpl_show_description = in_array( 'description', $t_fields );
 $tpl_description_textarea = $tpl_show_description ? string_textarea( $tpl_bug->description ) : '';
-$tpl_show_additional_information = in_array( 'additional_info', $t_fields );
+$tpl_show_additional_information = in_array( 'additional_info', $t_fields ) && access_compare_level( access_get_global_level(), config_get( 'view_additional_information_threshold' ) );
 $tpl_additional_information_textarea = $tpl_show_additional_information ? string_textarea( $tpl_bug->additional_information ) : '';
 $tpl_show_steps_to_reproduce = in_array( 'steps_to_reproduce', $t_fields );
 $tpl_steps_to_reproduce_textarea = $tpl_show_steps_to_reproduce ? string_textarea( $tpl_bug->steps_to_reproduce ) : '';
--- C:/Documents and Settings/vsel/mantisbt-1.2.8/core/history_api.php	Tue Sep 06 10:23:10 2011
+++ C:/Documents and Settings/vsel/mantisbt-edited/core/history_api.php	Wed Sep 21 18:43:16 2011
@@ -20,6 +20,8 @@
  * @copyright Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
  * @copyright Copyright (C) 2002 - 2011  MantisBT Team - mantisbt-dev@lists.sourceforge.net
  * @link http://www.mantisbt.org
+ *
+ * @uses access_api.php
  */
 
 /**
@@ -445,7 +447,9 @@
 				case ADDITIONAL_INFO_UPDATED:
 					$t_note = lang_get( 'additional_information_updated' );
 					$t_old_value = (int)$p_old_value;
-					if ( $p_linkify && bug_revision_exists( $t_old_value ) ) {
+					if ( $p_linkify && 
+						bug_revision_exists( $t_old_value ) &&
+						access_compare_level( access_get_global_level(), config_get( 'view_additional_information_threshold' ) ) ) {
 						$t_change = '<a href="bug_revision_view_page.php?rev_id=' . $t_old_value . '#r' . $t_old_value . '">' .
 							lang_get( 'view_revisions' ) . '</a>';
 						$t_raw = false;
--- C:/Documents and Settings/vsel/mantisbt-1.2.8/core/email_api.php	Tue Sep 06 10:23:10 2011
+++ C:/Documents and Settings/vsel/mantisbt-edited/core/email_api.php	Thu Sep 22 21:49:10 2011
@@ -1409,7 +1409,10 @@
 
 	$t_bug_data['email_summary'] = $row['summary'];
 	$t_bug_data['email_description'] = $row['description'];
+	
+	if ( access_compare_level( $t_user_access_level, config_get( 'view_additional_information_threshold' ) ) ) {
 	$t_bug_data['email_additional_information'] = $row['additional_information'];
+	}
 	$t_bug_data['email_steps_to_reproduce'] = $row['steps_to_reproduce'];
 
 	$t_bug_data['set_category'] = '[' . $t_bug_data['email_project'] . '] ' . $t_category_name;
0013336.diff (5,368 bytes)   

Activities

vincent_sels

vincent_sels

2011-09-21 12:51

reporter   ~0029824

I added this feature by adding a config setting:

$g_view_additional_information_threshold = DEVELOPER;

And adding the following check on 4 different pages, where Mantis checks to see if additional_information may/should be shown:

access_compare_level( access_get_global_level(), config_get( 'view_additional_information_threshold' ) )

The files where this has to be added are:
bug_view_inc.php
print_bug_inc.php
bug_update_advanced_page.php
core\history_api.php (you need to include @uses access_api.php)

The place it has to be inserted is straightforward.

I also changed the text to 'Technical information' ($s_additional_information)

Dentxinho

Dentxinho

2011-09-21 13:27

reporter   ~0029827

Can you make a patch for us to test? I'd be glad to test it.

vincent_sels

vincent_sels

2011-09-22 15:55

reporter   ~0029843

I'll leave that to the developers... :) I can't work with git anyway.

Addition: make sure the info isn't sent by mail.

File: core\email_api
Function: email_build_visible_bug_data

if ( access_compare_level( $t_user_access_level, config_get( 'view_additional_information_threshold' ) ) ) {
    $t_bug_data['email_additional_information'] = $row['additional_information'];
}
dregad

dregad

2011-09-26 03:50

developer   ~0029863

vincent_sels - even if you can't do git, it would be nice and helpful if you could at least provide a patch (unified diff) of all changes required to implement this, against the latest release, or even better, nightly build.

vincent_sels

vincent_sels

2011-09-26 15:49

reporter   ~0029868

I added a unified diff file, generated with WinMerge. It's compared to the 1.2.8 release. Does that work for you ?

dregad

dregad

2011-09-27 06:47

developer   ~0029870

Yes, that should be fine. Thanks for your contribution.