From ba7a63804f409c47c95ee192440b4be64e63a458 Mon Sep 17 00:00:00 2001
From: Damien Regad <damien.regad@merckserono.net>
Date: Tue, 18 Jan 2011 12:55:40 +0100
Subject: [PATCH] Fix #0005926: Filter "None" for custom fields with blank value

Generate the correct where clause for custom fields of type Checkbox and
Multiselection list, to return both bugs having an empty value ('', as
opposed to NULL) in the field as well as those without matching record in
mantis_custom_field_string_table.
---
 core/filter_api.php |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/core/filter_api.php b/core/filter_api.php
index 7b244c3..f2d6b43 100644
--- a/core/filter_api.php
+++ b/core/filter_api.php
@@ -1899,7 +1899,10 @@ function filter_get_bug_rows( &$p_page_number, &$p_per_page, &$p_page_count, &$p
 						switch( $t_def['type'] ) {
 							case CUSTOM_FIELD_TYPE_CHECKBOX:
 							case CUSTOM_FIELD_TYPE_MULTILIST:
-								$t_where_params[] = '%|' . $t_filter_member . '|%';
+								if( $t_filter_member != '' ) {
+									$t_filter_member = '%|' . $t_filter_member . '|%';
+								}
+								$t_where_params[] = $t_filter_member;
 								array_push( $t_filter_array, db_helper_like( "$t_table_name.value" ) );
 								break;
 							default:
-- 
1.7.1

