View Issue Details

IDProjectCategoryView StatusLast Update
0005926mantisbtadministrationpublic2014-09-23 18:05
ReporterPaul_Berg Assigned Todregad  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version1.0.0a3 
Target Version1.2.6Fixed in Version1.2.6 
Summary0005926: 'None' filter on checkbox field doesn't return bugs with a blank custom field value (as opposed to null/undefined values)
Description

I have created a custom field of the type "checkbox" with 3 possible values A, B and C.
When I filter on this field Mantis gives me 5 options to choose from: any, none, A, B, C.
If I choose "none" I'd expect Mantis to show me all issues for which none of the 3 checkboxes are set, instead it never shows me any issues.

Am I doing something wrong, or is this a bug?

Paul

Tagspatch
Attached Files
0001-Fix-0005926-Filter-None-for-custom-fields-with-blank.patch (1,284 bytes)   
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

Relationships

related to 0015721 closedgrangeway Functionality to consider porting to master-2.0.x 

Activities

thraxisp

thraxisp

2005-07-13 15:56

reporter   ~0010756

A filter value of [none] checks for '%||%" rather than ''.

ManhuntMark

ManhuntMark

2005-08-09 23:53

reporter   ~0011132

Last edited: 2005-08-10 00:03

It is possible that there may also be no record in the mantis_custom_field_string_table for every bug_id, so searching for '' won't return all of the values.

One of my custom field's write access is set to "manager" and I have several issues with missing values in the mantis_custom_field_string_table. The values get created when a "manager" or above updates the issue.

cs02rm0

cs02rm0

2007-01-03 10:27

reporter   ~0013890

This is what I'd expect too and more importantly, what my boss would expect. Any chance of a fix?

dregad

dregad

2011-01-18 07:26

developer   ~0027982

You will find attached a patch that fixes the issue for me.

I tested it for correct behavior in the following cases for the custom field:

  • not set at bug reporting (Display When Reporting Issues = unchecked)
  • bug updated by manager later on (Write Access = manager)
  • some values set, then unchecked to go back to blank value
  • no child record exists for the bug in mantis_custom_field_string_table (happens on bugs existing before the custom field is added to the project)
grangeway

grangeway

2013-04-05 17:57

reporter   ~0036448

Marking as 'acknowledged' not resolved/closed to track that change gets ported to master-2.0.x branch

Related Changesets

MantisBT: master-1.2.x c5cb6dfa

2011-01-17 22:55

dregad


Details Diff
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.
Affected Issues
0005926
mod - core/filter_api.php Diff File