View Issue Details

IDProjectCategoryView StatusLast Update
0010263mantisbtbugtrackerpublic2013-08-16 06:33
Reporterdhx Assigned Tojreese  
PrioritynormalSeverityfeatureReproducibilityN/A
Status closedResolutionfixed 
Product Versiongit trunk 
Target Version1.2.0rc1Fixed in Version1.2.0rc1 
Summary0010263: Implement g_bug_closed_status_threshold option to allow custom closed status
Description

I'm using Mantis in a project where we effectively have two closed statuses: 'COMPLETED' and 'NOT COMPLETED'. We have configured a completely different change request workflow from the defaults by redefining the status enum array.

The problem we discovered was that the summary page had hardcoded values for what tickets were considered CLOSED or RESOLVED. Because our COMPLETED level was less than the default CLOSED level (example: 70 vs 90) the status page would not show any bugs as being CLOSED.

Hence I am attaching a patch I made that creates a new g_bug_closed_status_threshold setting. This allows the user to define the status level at which a bug is considered closed. You're no longer locked into using the default status enum levels when it comes to the summary page. I've also fixed a few instances within the summary page where the RESOLVED threshold was hardcoded (as opposed to being based off the existing g_bug_resolved_status_threshold setting).

Tagsenum, resolved, status, summary
Attached Files
g_bug_closed_status_threshold.diff (14,370 bytes)   
diff --git a/config_defaults_inc.php b/config_defaults_inc.php
index ba33739..3acc42e 100644
--- a/config_defaults_inc.php
+++ b/config_defaults_inc.php
@@ -1718,12 +1718,20 @@
 
 	/**
 	 * Bug is resolved, ready to be closed or reopened.  In some custom installations a bug
-	 * maybe considered as resolved when it is moved to a custom (FIXED OR TESTED) status.
+	 * may be considered as resolved when it is moved to a custom (FIXED or TESTED) status.
 	 * @global int $g_bug_resolved_status_threshold
 	 */	
 	$g_bug_resolved_status_threshold = RESOLVED;
 
 	/**
+	 * Bug is closed.  In some custom installations there may exist multiple custom closed
+	 * statuses (CLOSED, COMPLETED or RELEASED) that partly or entirely replace the
+	 * functionality of the 'resolution' field.
+	 * @global int $g_bug_closed_status_threshold
+	 */	
+	$g_bug_closed_status_threshold = CLOSED;
+
+	/**
 	 * Automatically set status to ASSIGNED whenever a bug is assigned to a person.
 	 * This is useful for installations where assigned status is to be used when
 	 * the bug is in progress, rather than just put in a person's queue.
diff --git a/core/summary_api.php b/core/summary_api.php
index 46ec34c..0a164d6 100644
--- a/core/summary_api.php
+++ b/core/summary_api.php
@@ -68,7 +68,7 @@ function summary_print_by_enum( $p_enum_string, $p_enum ) {
 	$t_bugs_total = 0;
 
 	$t_resolved_val = config_get( 'bug_resolved_status_threshold' );
-	$t_closed_val = CLOSED;
+	$t_closed_val = config_get( 'bug_closed_status_threshold' );
 
 	while( $row = db_fetch_array( $result ) ) {
 		if(( $row[$p_enum] != $t_last_value ) && ( -1 != $t_last_value ) ) {
@@ -92,21 +92,21 @@ function summary_print_by_enum( $p_enum_string, $p_enum ) {
 
 			if( !is_blank( $t_bug_link ) ) {
 				if( 0 < $t_bugs_open ) {
-					$t_bugs_open = $t_bug_link . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . RESOLVED . '">' . $t_bugs_open . '</a>';
+					$t_bugs_open = $t_bug_link . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . $t_resolved_val . '">' . $t_bugs_open . '</a>';
 				} else {
 					if(( 'status' == $p_enum ) && ( $t_last_value >= $t_resolved_val ) ) {
 						$t_bugs_open = '-';
 					}
 				}
 				if( 0 < $t_bugs_resolved ) {
-					$t_bugs_resolved = $t_bug_link . '&amp;' . FILTER_PROPERTY_STATUS_ID . '=' . RESOLVED . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . CLOSED . '">' . $t_bugs_resolved . '</a>';
+					$t_bugs_resolved = $t_bug_link . '&amp;' . FILTER_PROPERTY_STATUS_ID . '=' . $t_resolved_val . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . $t_closed_val . '">' . $t_bugs_resolved . '</a>';
 				} else {
 					if(( 'status' == $p_enum ) && (( $t_last_value < $t_resolved_val ) || ( $t_last_value >= $t_closed_val ) ) ) {
 						$t_bugs_resolved = '-';
 					}
 				}
 				if( 0 < $t_bugs_closed ) {
-					$t_bugs_closed = $t_bug_link . '&amp;' . FILTER_PROPERTY_STATUS_ID . '=' . CLOSED . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=">' . $t_bugs_closed . '</a>';
+					$t_bugs_closed = $t_bug_link . '&amp;' . FILTER_PROPERTY_STATUS_ID . '=' . $t_closed_val . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=">' . $t_bugs_closed . '</a>';
 				} else {
 					if(( 'status' == $p_enum ) && ( $t_last_value < $t_closed_val ) ) {
 						$t_bugs_closed = '-';
@@ -157,21 +157,21 @@ function summary_print_by_enum( $p_enum_string, $p_enum ) {
 
 		if( !is_blank( $t_bug_link ) ) {
 			if( 0 < $t_bugs_open ) {
-				$t_bugs_open = $t_bug_link . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . RESOLVED . '">' . $t_bugs_open . '</a>';
+				$t_bugs_open = $t_bug_link . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . $t_resolved_val . '">' . $t_bugs_open . '</a>';
 			} else {
 				if(( 'status' == $p_enum ) && ( $t_last_value >= $t_resolved_val ) ) {
 					$t_bugs_open = '-';
 				}
 			}
 			if( 0 < $t_bugs_resolved ) {
-				$t_bugs_resolved = $t_bug_link . '&amp;' . FILTER_PROPERTY_STATUS_ID . '=' . RESOLVED . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . CLOSED . '">' . $t_bugs_resolved . '</a>';
+				$t_bugs_resolved = $t_bug_link . '&amp;' . FILTER_PROPERTY_STATUS_ID . '=' . $t_resolved_val . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . $t_closed_val . '">' . $t_bugs_resolved . '</a>';
 			} else {
 				if(( 'status' == $p_enum ) && (( $t_last_value < $t_resolved_val ) || ( $t_last_value >= $t_closed_val ) ) ) {
 					$t_bugs_resolved = '-';
 				}
 			}
 			if( 0 < $t_bugs_closed ) {
-				$t_bugs_closed = $t_bug_link . '&amp;' . FILTER_PROPERTY_STATUS_ID . '=' . CLOSED . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=">' . $t_bugs_closed . '</a>';
+				$t_bugs_closed = $t_bug_link . '&amp;' . FILTER_PROPERTY_STATUS_ID . '=' . $t_closed_val . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=">' . $t_bugs_closed . '</a>';
 			} else {
 				if(( 'status' == $p_enum ) && ( $t_last_value < $t_closed_val ) ) {
 					$t_bugs_closed = '-';
@@ -413,8 +413,8 @@ function summary_print_by_developer() {
 	$t_bugs_closed = 0;
 	$t_bugs_total = 0;
 
-	$t_resolved_val = RESOLVED;
-	$t_closed_val = CLOSED;
+	$t_resolved_val = config_get( 'bug_resolved_status_threshold' );
+	$t_closed_val = config_get( 'bug_closed_status_threshold' );
 
 	$t_summaryusers = array();
 	$t_summarydata = array();
@@ -434,13 +434,13 @@ function summary_print_by_developer() {
 
 			$t_bug_link = '<a class="subtle" href="' . config_get( 'bug_count_hyperlink_prefix' ) . '&amp;' . FILTER_PROPERTY_HANDLER_ID . '=' . $t_last_handler;
 			if( 0 < $t_bugs_open ) {
-				$t_bugs_open = $t_bug_link . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . RESOLVED . '">' . $t_bugs_open . '</a>';
+				$t_bugs_open = $t_bug_link . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . $t_resolved_val . '">' . $t_bugs_open . '</a>';
 			}
 			if( 0 < $t_bugs_resolved ) {
-				$t_bugs_resolved = $t_bug_link . '&amp;' . FILTER_PROPERTY_STATUS_ID . '=' . RESOLVED . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . CLOSED . '">' . $t_bugs_resolved . '</a>';
+				$t_bugs_resolved = $t_bug_link . '&amp;' . FILTER_PROPERTY_STATUS_ID . '=' . $t_resolved_val . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . $t_closed_val . '">' . $t_bugs_resolved . '</a>';
 			}
 			if( 0 < $t_bugs_closed ) {
-				$t_bugs_closed = $t_bug_link . '&amp;' . FILTER_PROPERTY_STATUS_ID . '=' . CLOSED . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=">' . $t_bugs_closed . '</a>';
+				$t_bugs_closed = $t_bug_link . '&amp;' . FILTER_PROPERTY_STATUS_ID . '=' . $t_closed_val . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=">' . $t_bugs_closed . '</a>';
 			}
 			if( 0 < $t_bugs_total ) {
 				$t_bugs_total = $t_bug_link . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=">' . $t_bugs_total . '</a>';
@@ -471,13 +471,13 @@ function summary_print_by_developer() {
 
 		$t_bug_link = '<a class="subtle" href="' . config_get( 'bug_count_hyperlink_prefix' ) . '&amp;' . FILTER_PROPERTY_HANDLER_ID . '=' . $t_last_handler;
 		if( 0 < $t_bugs_open ) {
-			$t_bugs_open = $t_bug_link . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . RESOLVED . '">' . $t_bugs_open . '</a>';
+			$t_bugs_open = $t_bug_link . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . $t_resolved_val . '">' . $t_bugs_open . '</a>';
 		}
 		if( 0 < $t_bugs_resolved ) {
-			$t_bugs_resolved = $t_bug_link . '&amp;' . FILTER_PROPERTY_STATUS_ID . '=' . RESOLVED . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . CLOSED . '">' . $t_bugs_resolved . '</a>';
+			$t_bugs_resolved = $t_bug_link . '&amp;' . FILTER_PROPERTY_STATUS_ID . '=' . $t_resolved_val . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . $t_closed_val . '">' . $t_bugs_resolved . '</a>';
 		}
 		if( 0 < $t_bugs_closed ) {
-			$t_bugs_closed = $t_bug_link . '&amp;' . FILTER_PROPERTY_STATUS_ID . '=' . CLOSED . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=">' . $t_bugs_closed . '</a>';
+			$t_bugs_closed = $t_bug_link . '&amp;' . FILTER_PROPERTY_STATUS_ID . '=' . $t_closed_val . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=">' . $t_bugs_closed . '</a>';
 		}
 		if( 0 < $t_bugs_total ) {
 			$t_bugs_total = $t_bug_link . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=">' . $t_bugs_total . '</a>';
@@ -530,8 +530,8 @@ function summary_print_by_reporter() {
 		$t_bugs_closed = 0;
 		$t_bugs_total = 0;
 
-		$t_resolved_val = RESOLVED;
-		$t_closed_val = CLOSED;
+		$t_resolved_val = config_get( 'bug_resolved_status_threshold' );
+		$t_closed_val = config_get( 'bug_closed_status_threshold' );
 
 		while( $row2 = db_fetch_array( $result2 ) ) {
 			$t_bugs_total += $row2['bugcount'];
@@ -550,13 +550,13 @@ function summary_print_by_reporter() {
 
 			$t_bug_link = '<a class="subtle" href="' . config_get( 'bug_count_hyperlink_prefix' ) . '&amp;' . FILTER_PROPERTY_REPORTER_ID . '=' . $v_reporter_id;
 			if( 0 < $t_bugs_open ) {
-				$t_bugs_open = $t_bug_link . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . RESOLVED . '">' . $t_bugs_open . '</a>';
+				$t_bugs_open = $t_bug_link . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . $t_resolved_val . '">' . $t_bugs_open . '</a>';
 			}
 			if( 0 < $t_bugs_resolved ) {
-				$t_bugs_resolved = $t_bug_link . '&amp;' . FILTER_PROPERTY_STATUS_ID . '=' . RESOLVED . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . CLOSED . '">' . $t_bugs_resolved . '</a>';
+				$t_bugs_resolved = $t_bug_link . '&amp;' . FILTER_PROPERTY_STATUS_ID . '=' . $t_resolved_val . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . $t_closed_val . '">' . $t_bugs_resolved . '</a>';
 			}
 			if( 0 < $t_bugs_closed ) {
-				$t_bugs_closed = $t_bug_link . '&amp;' . FILTER_PROPERTY_STATUS_ID . '=' . CLOSED . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=">' . $t_bugs_closed . '</a>';
+				$t_bugs_closed = $t_bug_link . '&amp;' . FILTER_PROPERTY_STATUS_ID . '=' . $t_closed_val . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=">' . $t_bugs_closed . '</a>';
 			}
 			if( 0 < $t_bugs_total ) {
 				$t_bugs_total = $t_bug_link . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=">' . $t_bugs_total . '</a>';
@@ -600,8 +600,8 @@ function summary_print_by_category() {
 	$t_bugs_closed = 0;
 	$t_bugs_total = 0;
 
-	$t_resolved_val = RESOLVED;
-	$t_closed_val = CLOSED;
+	$t_resolved_val = config_get( 'bug_resolved_status_threshold' );
+	$t_closed_val = config_get( 'bug_closed_status_threshold' );
 
 	while( $row = db_fetch_array( $result ) ) {
 		$v_category_id = $row['category_id'];
@@ -615,13 +615,13 @@ function summary_print_by_category() {
 
 			$t_bug_link = '<a class="subtle" href="' . config_get( 'bug_count_hyperlink_prefix' ) . '&amp;' . FILTER_PROPERTY_CATEGORY . '=' . urlencode( $last_category_name );
 			if( 0 < $t_bugs_open ) {
-				$t_bugs_open = $t_bug_link . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . RESOLVED . '">' . $t_bugs_open . '</a>';
+				$t_bugs_open = $t_bug_link . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . $t_resolved_val . '">' . $t_bugs_open . '</a>';
 			}
 			if( 0 < $t_bugs_resolved ) {
-				$t_bugs_resolved = $t_bug_link . '&amp;' . FILTER_PROPERTY_STATUS_ID . '=' . RESOLVED . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . CLOSED . '">' . $t_bugs_resolved . '</a>';
+				$t_bugs_resolved = $t_bug_link . '&amp;' . FILTER_PROPERTY_STATUS_ID . '=' . $t_resolved_val . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . $t_closed_val . '">' . $t_bugs_resolved . '</a>';
 			}
 			if( 0 < $t_bugs_closed ) {
-				$t_bugs_closed = $t_bug_link . '&amp;' . FILTER_PROPERTY_STATUS_ID . '=' . CLOSED . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=">' . $t_bugs_closed . '</a>';
+				$t_bugs_closed = $t_bug_link . '&amp;' . FILTER_PROPERTY_STATUS_ID . '=' . $t_closed_val . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=">' . $t_bugs_closed . '</a>';
 			}
 			if( 0 < $t_bugs_total ) {
 				$t_bugs_total = $t_bug_link . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=">' . $t_bugs_total . '</a>';
@@ -661,13 +661,13 @@ function summary_print_by_category() {
 		$t_bug_link = '<a class="subtle" href="' . config_get( 'bug_count_hyperlink_prefix' ) . '&amp;' . FILTER_PROPERTY_CATEGORY . '=' . urlencode( $last_category_name );
 		if( !is_blank( $t_bug_link ) ) {
 			if( 0 < $t_bugs_open ) {
-				$t_bugs_open = $t_bug_link . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . RESOLVED . '">' . $t_bugs_open . '</a>';
+				$t_bugs_open = $t_bug_link . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . $t_resolved_val . '">' . $t_bugs_open . '</a>';
 			}
 			if( 0 < $t_bugs_resolved ) {
-				$t_bugs_resolved = $t_bug_link . '&amp;' . FILTER_PROPERTY_STATUS_ID . '=' . RESOLVED . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . CLOSED . '">' . $t_bugs_resolved . '</a>';
+				$t_bugs_resolved = $t_bug_link . '&amp;' . FILTER_PROPERTY_STATUS_ID . '=' . $t_resolved_val . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . $t_closed_val . '">' . $t_bugs_resolved . '</a>';
 			}
 			if( 0 < $t_bugs_closed ) {
-				$t_bugs_closed = $t_bug_link . '&amp;' . FILTER_PROPERTY_STATUS_ID . '=' . CLOSED . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=">' . $t_bugs_closed . '</a>';
+				$t_bugs_closed = $t_bug_link . '&amp;' . FILTER_PROPERTY_STATUS_ID . '=' . $t_closed_val . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=">' . $t_bugs_closed . '</a>';
 			}
 			if( 0 < $t_bugs_total ) {
 				$t_bugs_total = $t_bug_link . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=">' . $t_bugs_total . '</a>';
@@ -704,8 +704,8 @@ function summary_print_by_project( $p_projects = null, $p_level = 0, $p_cache =
 		$result = db_query_bound( $query );
 		$p_cache = Array();
 
-		$t_resolved_val = RESOLVED;
-		$t_closed_val = CLOSED;
+		$t_resolved_val = config_get( 'bug_resolved_status_threshold' );
+		$t_closed_val = config_get( 'bug_closed_status_threshold' );
 
 		while( $row = db_fetch_array( $result ) ) {
 			$t_project_id = $row['project_id'];
diff --git a/lang/strings_english.txt b/lang/strings_english.txt
index d5204ae..f77b6a5 100644
--- a/lang/strings_english.txt
+++ b/lang/strings_english.txt
@@ -810,6 +810,7 @@ $s_access_change = 'Minimum Access Level to Change to this Status';
 $s_desc_bug_submit_status = 'Status to which a new issue is set';
 $s_desc_bug_reopen_status = 'Status to which reopened issues are set';
 $s_desc_bug_resolved_status_threshold = 'Status where an issue is considered resolved';
+$s_desc_bug_closed_status_threshold = 'Status where an issue is considered closed';
 $s_workflow_change_access = 'Who can change workflow';
 $s_access_change_access = 'Who can change access levels';
 
10263.patch (15,311 bytes)   
From 67a7b4f0f25a80d6deac5b42d19db035f0b851fe Mon Sep 17 00:00:00 2001
From: David Hicks <hickseydr@optusnet.com.au>
Date: Sun, 29 Mar 2009 22:55:52 +1100
Subject: [PATCH] Create new g_bug_closed_status_threshold setting to allow for
 custom installations where there may exist different or multiple
 closed statuses (COMPLETED vs NOT COMPLETED, IMPLEMENTED, etc).

The summary page used to use hardcoded defaults such as CLOSED
and RESOLVED. This patch replaces those hardcoded defaults with
the thresholds set in the Mantis configuration. The summary page
will now show the number of resolved and closed tickets
correctly in a custom installation where the default RESOLVED
and or CLOSED statuses are not being used.

Signed-off-by: David Hicks <hickseydr@optusnet.com.au>
---
 config_defaults_inc.php  |   11 +++++++-
 core/summary_api.php     |   60 +++++++++++++++++++++++-----------------------
 lang/strings_english.txt |    1 +
 3 files changed, 40 insertions(+), 32 deletions(-)

diff --git a/config_defaults_inc.php b/config_defaults_inc.php
index d551adc..2bb750c 100644
--- a/config_defaults_inc.php
+++ b/config_defaults_inc.php
@@ -1718,12 +1718,19 @@
 
 	/**
 	 * Bug is resolved, ready to be closed or reopened.  In some custom installations a bug
-	 * maybe considered as resolved when it is moved to a custom (FIXED OR TESTED) status.
+	 * may be considered as resolved when it is moved to a custom (FIXED or TESTED) status.
 	 * @global int $g_bug_resolved_status_threshold
-	 */	
+	 */
 	$g_bug_resolved_status_threshold = RESOLVED;
 
 	/**
+	 * Bug is closed.  In some custom installations a bug may be considered as closed when
+	 * it is moved to a custom (COMPLETED or IMPLEMENTED) status.
+	 * @global int $g_bug_closed_status_threshold
+	 */
+	$g_bug_closed_status_threshold = CLOSED;
+
+	/**
 	 * Automatically set status to ASSIGNED whenever a bug is assigned to a person.
 	 * This is useful for installations where assigned status is to be used when
 	 * the bug is in progress, rather than just put in a person's queue.
diff --git a/core/summary_api.php b/core/summary_api.php
index 46ec34c..0a164d6 100644
--- a/core/summary_api.php
+++ b/core/summary_api.php
@@ -68,7 +68,7 @@ function summary_print_by_enum( $p_enum_string, $p_enum ) {
 	$t_bugs_total = 0;
 
 	$t_resolved_val = config_get( 'bug_resolved_status_threshold' );
-	$t_closed_val = CLOSED;
+	$t_closed_val = config_get( 'bug_closed_status_threshold' );
 
 	while( $row = db_fetch_array( $result ) ) {
 		if(( $row[$p_enum] != $t_last_value ) && ( -1 != $t_last_value ) ) {
@@ -92,21 +92,21 @@ function summary_print_by_enum( $p_enum_string, $p_enum ) {
 
 			if( !is_blank( $t_bug_link ) ) {
 				if( 0 < $t_bugs_open ) {
-					$t_bugs_open = $t_bug_link . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . RESOLVED . '">' . $t_bugs_open . '</a>';
+					$t_bugs_open = $t_bug_link . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . $t_resolved_val . '">' . $t_bugs_open . '</a>';
 				} else {
 					if(( 'status' == $p_enum ) && ( $t_last_value >= $t_resolved_val ) ) {
 						$t_bugs_open = '-';
 					}
 				}
 				if( 0 < $t_bugs_resolved ) {
-					$t_bugs_resolved = $t_bug_link . '&amp;' . FILTER_PROPERTY_STATUS_ID . '=' . RESOLVED . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . CLOSED . '">' . $t_bugs_resolved . '</a>';
+					$t_bugs_resolved = $t_bug_link . '&amp;' . FILTER_PROPERTY_STATUS_ID . '=' . $t_resolved_val . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . $t_closed_val . '">' . $t_bugs_resolved . '</a>';
 				} else {
 					if(( 'status' == $p_enum ) && (( $t_last_value < $t_resolved_val ) || ( $t_last_value >= $t_closed_val ) ) ) {
 						$t_bugs_resolved = '-';
 					}
 				}
 				if( 0 < $t_bugs_closed ) {
-					$t_bugs_closed = $t_bug_link . '&amp;' . FILTER_PROPERTY_STATUS_ID . '=' . CLOSED . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=">' . $t_bugs_closed . '</a>';
+					$t_bugs_closed = $t_bug_link . '&amp;' . FILTER_PROPERTY_STATUS_ID . '=' . $t_closed_val . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=">' . $t_bugs_closed . '</a>';
 				} else {
 					if(( 'status' == $p_enum ) && ( $t_last_value < $t_closed_val ) ) {
 						$t_bugs_closed = '-';
@@ -157,21 +157,21 @@ function summary_print_by_enum( $p_enum_string, $p_enum ) {
 
 		if( !is_blank( $t_bug_link ) ) {
 			if( 0 < $t_bugs_open ) {
-				$t_bugs_open = $t_bug_link . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . RESOLVED . '">' . $t_bugs_open . '</a>';
+				$t_bugs_open = $t_bug_link . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . $t_resolved_val . '">' . $t_bugs_open . '</a>';
 			} else {
 				if(( 'status' == $p_enum ) && ( $t_last_value >= $t_resolved_val ) ) {
 					$t_bugs_open = '-';
 				}
 			}
 			if( 0 < $t_bugs_resolved ) {
-				$t_bugs_resolved = $t_bug_link . '&amp;' . FILTER_PROPERTY_STATUS_ID . '=' . RESOLVED . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . CLOSED . '">' . $t_bugs_resolved . '</a>';
+				$t_bugs_resolved = $t_bug_link . '&amp;' . FILTER_PROPERTY_STATUS_ID . '=' . $t_resolved_val . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . $t_closed_val . '">' . $t_bugs_resolved . '</a>';
 			} else {
 				if(( 'status' == $p_enum ) && (( $t_last_value < $t_resolved_val ) || ( $t_last_value >= $t_closed_val ) ) ) {
 					$t_bugs_resolved = '-';
 				}
 			}
 			if( 0 < $t_bugs_closed ) {
-				$t_bugs_closed = $t_bug_link . '&amp;' . FILTER_PROPERTY_STATUS_ID . '=' . CLOSED . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=">' . $t_bugs_closed . '</a>';
+				$t_bugs_closed = $t_bug_link . '&amp;' . FILTER_PROPERTY_STATUS_ID . '=' . $t_closed_val . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=">' . $t_bugs_closed . '</a>';
 			} else {
 				if(( 'status' == $p_enum ) && ( $t_last_value < $t_closed_val ) ) {
 					$t_bugs_closed = '-';
@@ -413,8 +413,8 @@ function summary_print_by_developer() {
 	$t_bugs_closed = 0;
 	$t_bugs_total = 0;
 
-	$t_resolved_val = RESOLVED;
-	$t_closed_val = CLOSED;
+	$t_resolved_val = config_get( 'bug_resolved_status_threshold' );
+	$t_closed_val = config_get( 'bug_closed_status_threshold' );
 
 	$t_summaryusers = array();
 	$t_summarydata = array();
@@ -434,13 +434,13 @@ function summary_print_by_developer() {
 
 			$t_bug_link = '<a class="subtle" href="' . config_get( 'bug_count_hyperlink_prefix' ) . '&amp;' . FILTER_PROPERTY_HANDLER_ID . '=' . $t_last_handler;
 			if( 0 < $t_bugs_open ) {
-				$t_bugs_open = $t_bug_link . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . RESOLVED . '">' . $t_bugs_open . '</a>';
+				$t_bugs_open = $t_bug_link . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . $t_resolved_val . '">' . $t_bugs_open . '</a>';
 			}
 			if( 0 < $t_bugs_resolved ) {
-				$t_bugs_resolved = $t_bug_link . '&amp;' . FILTER_PROPERTY_STATUS_ID . '=' . RESOLVED . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . CLOSED . '">' . $t_bugs_resolved . '</a>';
+				$t_bugs_resolved = $t_bug_link . '&amp;' . FILTER_PROPERTY_STATUS_ID . '=' . $t_resolved_val . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . $t_closed_val . '">' . $t_bugs_resolved . '</a>';
 			}
 			if( 0 < $t_bugs_closed ) {
-				$t_bugs_closed = $t_bug_link . '&amp;' . FILTER_PROPERTY_STATUS_ID . '=' . CLOSED . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=">' . $t_bugs_closed . '</a>';
+				$t_bugs_closed = $t_bug_link . '&amp;' . FILTER_PROPERTY_STATUS_ID . '=' . $t_closed_val . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=">' . $t_bugs_closed . '</a>';
 			}
 			if( 0 < $t_bugs_total ) {
 				$t_bugs_total = $t_bug_link . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=">' . $t_bugs_total . '</a>';
@@ -471,13 +471,13 @@ function summary_print_by_developer() {
 
 		$t_bug_link = '<a class="subtle" href="' . config_get( 'bug_count_hyperlink_prefix' ) . '&amp;' . FILTER_PROPERTY_HANDLER_ID . '=' . $t_last_handler;
 		if( 0 < $t_bugs_open ) {
-			$t_bugs_open = $t_bug_link . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . RESOLVED . '">' . $t_bugs_open . '</a>';
+			$t_bugs_open = $t_bug_link . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . $t_resolved_val . '">' . $t_bugs_open . '</a>';
 		}
 		if( 0 < $t_bugs_resolved ) {
-			$t_bugs_resolved = $t_bug_link . '&amp;' . FILTER_PROPERTY_STATUS_ID . '=' . RESOLVED . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . CLOSED . '">' . $t_bugs_resolved . '</a>';
+			$t_bugs_resolved = $t_bug_link . '&amp;' . FILTER_PROPERTY_STATUS_ID . '=' . $t_resolved_val . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . $t_closed_val . '">' . $t_bugs_resolved . '</a>';
 		}
 		if( 0 < $t_bugs_closed ) {
-			$t_bugs_closed = $t_bug_link . '&amp;' . FILTER_PROPERTY_STATUS_ID . '=' . CLOSED . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=">' . $t_bugs_closed . '</a>';
+			$t_bugs_closed = $t_bug_link . '&amp;' . FILTER_PROPERTY_STATUS_ID . '=' . $t_closed_val . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=">' . $t_bugs_closed . '</a>';
 		}
 		if( 0 < $t_bugs_total ) {
 			$t_bugs_total = $t_bug_link . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=">' . $t_bugs_total . '</a>';
@@ -530,8 +530,8 @@ function summary_print_by_reporter() {
 		$t_bugs_closed = 0;
 		$t_bugs_total = 0;
 
-		$t_resolved_val = RESOLVED;
-		$t_closed_val = CLOSED;
+		$t_resolved_val = config_get( 'bug_resolved_status_threshold' );
+		$t_closed_val = config_get( 'bug_closed_status_threshold' );
 
 		while( $row2 = db_fetch_array( $result2 ) ) {
 			$t_bugs_total += $row2['bugcount'];
@@ -550,13 +550,13 @@ function summary_print_by_reporter() {
 
 			$t_bug_link = '<a class="subtle" href="' . config_get( 'bug_count_hyperlink_prefix' ) . '&amp;' . FILTER_PROPERTY_REPORTER_ID . '=' . $v_reporter_id;
 			if( 0 < $t_bugs_open ) {
-				$t_bugs_open = $t_bug_link . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . RESOLVED . '">' . $t_bugs_open . '</a>';
+				$t_bugs_open = $t_bug_link . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . $t_resolved_val . '">' . $t_bugs_open . '</a>';
 			}
 			if( 0 < $t_bugs_resolved ) {
-				$t_bugs_resolved = $t_bug_link . '&amp;' . FILTER_PROPERTY_STATUS_ID . '=' . RESOLVED . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . CLOSED . '">' . $t_bugs_resolved . '</a>';
+				$t_bugs_resolved = $t_bug_link . '&amp;' . FILTER_PROPERTY_STATUS_ID . '=' . $t_resolved_val . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . $t_closed_val . '">' . $t_bugs_resolved . '</a>';
 			}
 			if( 0 < $t_bugs_closed ) {
-				$t_bugs_closed = $t_bug_link . '&amp;' . FILTER_PROPERTY_STATUS_ID . '=' . CLOSED . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=">' . $t_bugs_closed . '</a>';
+				$t_bugs_closed = $t_bug_link . '&amp;' . FILTER_PROPERTY_STATUS_ID . '=' . $t_closed_val . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=">' . $t_bugs_closed . '</a>';
 			}
 			if( 0 < $t_bugs_total ) {
 				$t_bugs_total = $t_bug_link . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=">' . $t_bugs_total . '</a>';
@@ -600,8 +600,8 @@ function summary_print_by_category() {
 	$t_bugs_closed = 0;
 	$t_bugs_total = 0;
 
-	$t_resolved_val = RESOLVED;
-	$t_closed_val = CLOSED;
+	$t_resolved_val = config_get( 'bug_resolved_status_threshold' );
+	$t_closed_val = config_get( 'bug_closed_status_threshold' );
 
 	while( $row = db_fetch_array( $result ) ) {
 		$v_category_id = $row['category_id'];
@@ -615,13 +615,13 @@ function summary_print_by_category() {
 
 			$t_bug_link = '<a class="subtle" href="' . config_get( 'bug_count_hyperlink_prefix' ) . '&amp;' . FILTER_PROPERTY_CATEGORY . '=' . urlencode( $last_category_name );
 			if( 0 < $t_bugs_open ) {
-				$t_bugs_open = $t_bug_link . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . RESOLVED . '">' . $t_bugs_open . '</a>';
+				$t_bugs_open = $t_bug_link . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . $t_resolved_val . '">' . $t_bugs_open . '</a>';
 			}
 			if( 0 < $t_bugs_resolved ) {
-				$t_bugs_resolved = $t_bug_link . '&amp;' . FILTER_PROPERTY_STATUS_ID . '=' . RESOLVED . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . CLOSED . '">' . $t_bugs_resolved . '</a>';
+				$t_bugs_resolved = $t_bug_link . '&amp;' . FILTER_PROPERTY_STATUS_ID . '=' . $t_resolved_val . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . $t_closed_val . '">' . $t_bugs_resolved . '</a>';
 			}
 			if( 0 < $t_bugs_closed ) {
-				$t_bugs_closed = $t_bug_link . '&amp;' . FILTER_PROPERTY_STATUS_ID . '=' . CLOSED . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=">' . $t_bugs_closed . '</a>';
+				$t_bugs_closed = $t_bug_link . '&amp;' . FILTER_PROPERTY_STATUS_ID . '=' . $t_closed_val . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=">' . $t_bugs_closed . '</a>';
 			}
 			if( 0 < $t_bugs_total ) {
 				$t_bugs_total = $t_bug_link . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=">' . $t_bugs_total . '</a>';
@@ -661,13 +661,13 @@ function summary_print_by_category() {
 		$t_bug_link = '<a class="subtle" href="' . config_get( 'bug_count_hyperlink_prefix' ) . '&amp;' . FILTER_PROPERTY_CATEGORY . '=' . urlencode( $last_category_name );
 		if( !is_blank( $t_bug_link ) ) {
 			if( 0 < $t_bugs_open ) {
-				$t_bugs_open = $t_bug_link . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . RESOLVED . '">' . $t_bugs_open . '</a>';
+				$t_bugs_open = $t_bug_link . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . $t_resolved_val . '">' . $t_bugs_open . '</a>';
 			}
 			if( 0 < $t_bugs_resolved ) {
-				$t_bugs_resolved = $t_bug_link . '&amp;' . FILTER_PROPERTY_STATUS_ID . '=' . RESOLVED . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . CLOSED . '">' . $t_bugs_resolved . '</a>';
+				$t_bugs_resolved = $t_bug_link . '&amp;' . FILTER_PROPERTY_STATUS_ID . '=' . $t_resolved_val . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . $t_closed_val . '">' . $t_bugs_resolved . '</a>';
 			}
 			if( 0 < $t_bugs_closed ) {
-				$t_bugs_closed = $t_bug_link . '&amp;' . FILTER_PROPERTY_STATUS_ID . '=' . CLOSED . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=">' . $t_bugs_closed . '</a>';
+				$t_bugs_closed = $t_bug_link . '&amp;' . FILTER_PROPERTY_STATUS_ID . '=' . $t_closed_val . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=">' . $t_bugs_closed . '</a>';
 			}
 			if( 0 < $t_bugs_total ) {
 				$t_bugs_total = $t_bug_link . '&amp;' . FILTER_PROPERTY_HIDE_STATUS_ID . '=">' . $t_bugs_total . '</a>';
@@ -704,8 +704,8 @@ function summary_print_by_project( $p_projects = null, $p_level = 0, $p_cache =
 		$result = db_query_bound( $query );
 		$p_cache = Array();
 
-		$t_resolved_val = RESOLVED;
-		$t_closed_val = CLOSED;
+		$t_resolved_val = config_get( 'bug_resolved_status_threshold' );
+		$t_closed_val = config_get( 'bug_closed_status_threshold' );
 
 		while( $row = db_fetch_array( $result ) ) {
 			$t_project_id = $row['project_id'];
diff --git a/lang/strings_english.txt b/lang/strings_english.txt
index 74baa1f..3a677a3 100644
--- a/lang/strings_english.txt
+++ b/lang/strings_english.txt
@@ -811,6 +811,7 @@ $s_access_change = 'Minimum Access Level to Change to this Status';
 $s_desc_bug_submit_status = 'Status to which a new issue is set';
 $s_desc_bug_reopen_status = 'Status to which reopened issues are set';
 $s_desc_bug_resolved_status_threshold = 'Status where an issue is considered resolved';
+$s_desc_bug_closed_status_threshold = 'Status where an issue is considered closed';
 $s_workflow_change_access = 'Who can change workflow';
 $s_access_change_access = 'Who can change access levels';
 
-- 
1.6.2

10263.patch (15,311 bytes)   

Activities

dhx

dhx

2009-03-27 02:30

reporter   ~0021230

Just to clarify, the patch has been released into the public domain (no licensing issues I hope).

jreese

jreese

2009-03-27 13:28

reporter   ~0021235

I like the patch, but I have a couple minor things that I'd like to see changed:

  • first, would you mind generating a "formatted patch" from Git for the feature? See http://docs.mantisbt.org/master/en/developers/dev.contrib.submit.html for details.

  • second, I'd like to see the closed threshold description more closely match the description for the resolved threshold, eg "Bug is closed. In some custom installations a bug may be considered as closed when it is moved to a custom (FIXED OR TESTED) status."

Otherwise, it looks like a pretty good feature. Cheers.

dhx

dhx

2009-03-29 08:07

reporter   ~0021260

I've attached a formatted patch (hopefully to the required spec) inclusive of the change you suggested. Thanks :)

dhx

dhx

2009-03-30 02:31

reporter   ~0021268

Alternatively you should also now be able to pull it from branch '10263' at git://git.mantisforge.org/mantisbt/dhx.git

... assuming I did everything correctly with setting up the remote git repo.

jreese

jreese

2009-03-30 10:19

reporter   ~0021290

Fix committed to 1.2.x development tree.

Related Changesets

MantisBT: master da551105

2009-03-29 07:55

dhx


Details Diff
Create new g_bug_closed_status_threshold setting to allow for
custom installations where there may exist different or multiple
closed statuses (COMPLETED vs NOT COMPLETED, IMPLEMENTED, etc).

The summary page used to use hardcoded defaults such as CLOSED
and RESOLVED. This patch replaces those hardcoded defaults with
the thresholds set in the Mantis configuration. The summary page
will now show the number of resolved and closed tickets
correctly in a custom installation where the default RESOLVED
and or CLOSED statuses are not being used.

<span class="signoff">Signed-off-by: John Reese <jreese@leetcode.net></span>
Affected Issues
0010263
mod - core/summary_api.php Diff File
mod - config_defaults_inc.php Diff File
mod - lang/strings_english.txt Diff File