View Issue Details

IDProjectCategoryView StatusLast Update
0012061mantisbtotherpublic2010-12-17 04:40
ReporterSergiodf Assigned Todhx  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version1.2.1 
Target Version1.2.4Fixed in Version1.2.4 
Summary0012061: Status percentage bar counts issues hidden to user
Description

If Status percentage bar is enabled ($g_status_percentage_legend = ON), private bugs are count even if current user level is under $g_private_bug_threshold.

Tagspatch
Attached Files
12061.diff (961 bytes)   
--- C:/Documents and Settings/sdelfranco/Escritorio/mantis/mantisbt-1.2.1-official/core/html_api.php	Fri Apr 23 14:28:34 2010
+++ C:/Documents and Settings/sdelfranco/Escritorio/mantis/mantisbt-1.2.1-patches/core/html_api.php	Mon Jun 14 12:51:37 2010
@@ -1251,6 +1251,7 @@
  * @return null
  */
 function html_status_percentage_legend() {
+	global $g_private_bug_threshold;
 	$t_mantis_bug_table = db_get_table( 'mantis_bug_table' );
 	$t_project_id = helper_get_current_project();
 	$t_user_id = auth_get_current_user_id();
@@ -1260,8 +1261,11 @@
 
 	$query = "SELECT status, COUNT(*) AS number
 				FROM $t_mantis_bug_table
-				WHERE $t_specific_where
-				GROUP BY status";
+				WHERE $t_specific_where";
+	if($g_private_bug_threshold > access_get_project_level($t_project_id, $t_user_id)) {
+		$query .= ' AND view_state < '.VS_PRIVATE;
+	}
+	$query .= "GROUP BY status";
 	$result = db_query_bound( $query );
 
 	$t_bug_count = 0;
12061.diff (961 bytes)   

Activities

dhx

dhx

2010-10-22 08:22

reporter   ~0027130

Thanks for a nice and simple patch Sergio, I've committed it (slightly amended).

Just a tip for the future: try to avoid global variables such as $g_ when they're not necessary. In this case I have changed it to use the access_has_project_level() function with config_get() to determine whether the current user can see private bugs.

Good work, and thanks again for your contribution!

Related Changesets

MantisBT: master ee1371d4

2010-10-22 08:17

Sergiodf

Committer: dhx


Details Diff
Fix 0012061: Status percentage bar should check for private bugs

If the status percentage bar is enabled ($g_status_percentage_legend =
ON), private bugs are counted even if the current user level is under
$g_private_bug_threshold.

Co-contributed-by: David Hicks <hickseydr@optusnet.com.au>
Signed-off-by: David Hicks <hickseydr@optusnet.com.au>
Affected Issues
0012061
mod - core/html_api.php Diff File

MantisBT: master-1.2.x c783a403

2010-10-22 08:17

Sergiodf

Committer: dhx


Details Diff
Fix 0012061: Status percentage bar should check for private bugs

If the status percentage bar is enabled ($g_status_percentage_legend =
ON), private bugs are counted even if the current user level is under
$g_private_bug_threshold.

Co-contributed-by: David Hicks <hickseydr@optusnet.com.au>
Signed-off-by: David Hicks <hickseydr@optusnet.com.au>
Affected Issues
0012061
mod - core/html_api.php Diff File