View Issue Details

IDProjectCategoryView StatusLast Update
0012487mantisbtfeaturepublic2013-05-24 04:19
Reporterjameno123 Assigned To 
PrioritynoneSeverityfeatureReproducibilityN/A
Status newResolutionopen 
Product Version1.2.3 
Summary0012487: Add a NOT_HANDLER_ID filter, filter by handler id NOT in x
Description

We use this patch to filter our results to a where 'handler_id' NOT IN (x) and thought it might be useful to the mantis community. I have very limited experience on the mantis code so its possible that its not setup correctly.... Look over the patch and let me know if there is anything you would like changed.

We add a few items:
(1) a string in lang/english for "assignedothers" - "Assigned to others"
(2) a filter FILTER_PROPERTY_NOT_HANDLER_ID to filter where handler_id NOT in x
(3) a ticket list box on the my_view page which shows tickets assigned to others.

Additional Information

Code is free to use in any way shape or form you want, no attribution etc requested (this is not a license statement) -- seriously use it anyway you want including sending it to /dev/null :)

TagsNo tags attached.
Attached Files
mantisbt-1.2.3-assignedothers.patch (4,347 bytes)   
#
# To apply:
# 1) tar -xvfz mantisbt-1.2.3
# 2) cd mantisbt-1.2.3
# 3) patch -p 1 -i ../path/to/mantisbt-1.2.3-assignedothers.patch
#
diff -r -u mantisbt-1.2.3-orig//config_filter_defaults_inc.php mantisbt-1.2.3//config_filter_defaults_inc.php
--- mantisbt-1.2.3-orig//config_filter_defaults_inc.php	2010-09-14 14:40:10.000000000 -0400
+++ mantisbt-1.2.3//config_filter_defaults_inc.php	2010-10-26 22:11:40.000000000 -0400
@@ -37,6 +37,7 @@
     define( 'FILTER_PROPERTY_RESOLUTION_ID', 'show_resolution' );
     define( 'FILTER_PROPERTY_PRODUCT_BUILD', 'show_build' );
     define( 'FILTER_PROPERTY_PRODUCT_VERSION', 'show_version' );
+    define( 'FILTER_PROPERTY_NOT_HANDLER_ID', 'not_handler_id' );
 
     define( 'FILTER_PROPERTY_MONITOR_USER_ID', 'user_monitor' );
     define( 'FILTER_PROPERTY_HIDE_STATUS_ID', 'hide_status' );
diff -r -u mantisbt-1.2.3-orig//core/filter_api.php mantisbt-1.2.3//core/filter_api.php
--- mantisbt-1.2.3-orig//core/filter_api.php	2010-09-14 14:40:10.000000000 -0400
+++ mantisbt-1.2.3//core/filter_api.php	2010-10-26 22:23:56.000000000 -0400
@@ -1303,6 +1303,24 @@
 		log_event( LOG_FILTERING, 'no handler query' );
 	}
 
+	# Handler NOT in
+        if( !filter_field_is_any( $t_filter[FILTER_PROPERTY_NOT_HANDLER] ) ) {
+		if (is_scalar($t_filter[FILTER_PROPERTY_NOT_HANDLER]) && is_numeric($t_filter[FILTER_PROPERTY_NOT_HANDLER])) {
+			$t_filter[FILTER_PROPERTY_NOT_HANDLER] = array($t_filter[FILTER_PROPERTY_NOT_HANDLER]);
+		}
+
+		if (is_array($t_filter[FILTER_PROPERTY_NOT_HANDLER])) {
+			$t_nothandler_query = "($t_bug_table.handler_id NOT IN(";
+			foreach ($t_filter[FILTER_PROPERTY_NOT_HANDLER] as $t_filter_member) {
+				$t_nothandler_query .= db_prepare_int($t_filter_member).',';
+			}
+
+			$t_nothandler_query = substr($t_nothandler_query,0,-1).'))';
+			array_push($t_where_clauses, $t_nothandler_query);
+			unset($t_filter_member,$t_nothandler_query);
+		}
+        }
+
 	# category
 	if( !filter_field_is_any( $t_filter[FILTER_PROPERTY_CATEGORY] ) ) {
 		$t_clauses = array();
diff -r -u mantisbt-1.2.3-orig//lang/strings_english.txt mantisbt-1.2.3//lang/strings_english.txt
--- mantisbt-1.2.3-orig//lang/strings_english.txt	2010-09-14 14:40:10.000000000 -0400
+++ mantisbt-1.2.3//lang/strings_english.txt	2010-10-26 22:03:37.000000000 -0400
@@ -1014,6 +1014,7 @@
 $s_my_view_title_recent_mod = 'Recently Modified';
 $s_my_view_title_reported = 'Reported by Me';
 $s_my_view_title_assigned = 'Assigned to Me (Unresolved)';
+$s_my_view_title_assignedother = 'Assigned to Others (Unresolved)';
 $s_my_view_title_resolved = 'Resolved';
 $s_my_view_title_monitored = 'Monitored by Me';
 $s_my_view_title_feedback = 'Awaiting Feedback from Me';
diff -r -u mantisbt-1.2.3-orig//my_view_inc.php mantisbt-1.2.3//my_view_inc.php
--- mantisbt-1.2.3-orig//my_view_inc.php	2010-09-14 14:40:10.000000000 -0400
+++ mantisbt-1.2.3//my_view_inc.php	2010-10-26 22:08:19.000000000 -0400
@@ -93,6 +93,45 @@
 );
 $url_link_parameters['assigned'] = FILTER_PROPERTY_HANDLER_ID . '=' . $t_current_user_id . '&' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . $t_bug_resolved_status_threshold;
 
+$c_filter['assignedother'] = array(
+	FILTER_PROPERTY_CATEGORY => Array(
+		'0' => META_FILTER_ANY,
+	),
+	FILTER_PROPERTY_SEVERITY_ID => Array(
+		'0' => META_FILTER_ANY,
+	),
+	FILTER_PROPERTY_STATUS_ID => Array(
+		'0' => META_FILTER_ANY,
+	),
+	FILTER_PROPERTY_HIGHLIGHT_CHANGED => $t_default_show_changed,
+	FILTER_PROPERTY_REPORTER_ID => Array(
+		'0' => META_FILTER_ANY,
+	),
+	FILTER_PROPERTY_HANDLER_ID => Array(
+		'0' => $t_current_user_id,
+	),
+	FILTER_PROPERTY_RESOLUTION_ID => Array(
+		'0' => META_FILTER_ANY,
+	),
+	FILTER_PROPERTY_PRODUCT_BUILD => Array(
+		'0' => META_FILTER_ANY,
+	),
+	FILTER_PROPERTY_PRODUCT_VERSION => Array(
+		'0' => META_FILTER_ANY,
+	),
+	FILTER_PROPERTY_HIDE_STATUS_ID => Array(
+		'0' => $t_bug_resolved_status_threshold,
+	),
+	FILTER_PROPERTY_MONITOR_USER_ID => Array(
+		'0' => META_FILTER_ANY,
+	),
+	FILTER_PROPERTY_NOT_HANDLER_ID => Array(
+		'0' => 0,
+		'1' => $t_current_user_id,
+	),
+);
+$url_link_parameters['assignedother'] = FILTER_PROPERTY_HANDLER_ID . '=' . $t_current_user_id . '&' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . $t_bug_resolved_status_threshold;
+
 $c_filter['recent_mod'] = array(
 	FILTER_PROPERTY_CATEGORY => Array(
 		'0' => META_FILTER_ANY,

Relationships

related to 0006382 acknowledged Add a NOT switch to filter settings 

Activities