View Issue Details

IDProjectCategoryView StatusLast Update
0021712mantisbtfilterspublic2019-12-09 04:32
ReporterPantsManUK Assigned Tocproensa  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version1.3.0-rc.2 
Target Version2.23.0Fixed in Version2.23.0 
Summary0021712: No way to filter "negative" for checkbox custom fields
Description

If you create a checkbox custom field, you can use the View Issues filtering to look for the "positive" value that indicates the checkbox is checked easily enough, but there's currently no way to look for the "negative" (not checked) value; setting the search criteria to '[none]' in 1.3.1 returns nothing.

Additional Information

This appears to be a side-effect of the change over to the use of the vertical bar delimiter around field values in mantis_custom_field_string_table: the checked value is stored in the form "|value|", but the unchecked value is stored as the null string (""). If you manually set the custom field default value to "||" (the delimited null string), MantisBT complains about invalid values when submitting an issue. Setting the database column default value appears to do nothing, it would seem that Mantis constructs an explicit 'value=""' when populating the database.

In 1.2.X, this functionality worked as I would expect; filtering for '[none]' returned the "field not checked" issues. In order to reinstate the functionality (we have a number of filters that relied on searching for "custom fields unchecked") I've had to kludge the unchecked values in the database into being "||".

TagsNo tags attached.

Activities

PantsManUK

PantsManUK

2016-09-23 04:25

reporter   ~0054066

If I've put this in the wrong category, please correct.

dregad

dregad

2016-09-23 08:47

developer   ~0054068

Given a test DB with 3 issues (1, 2 and 3), a checkbox custom field with a single element labelled 'on', and a custom_field_strings table with the following values (note, no CF string defined for issue 1)
<pre>
field_id bug_id value
1 2 <blank>
1 3 |on|
</pre>

Applying the 3 distinct filters combinations returns the following results

In 1.2.x:

  • checkbox = [any]: 1, 2, 3
  • checkbox = [none]: 1, 2
  • checkbox = 'on': 3

In 1.3.x:

  • checkbox = [any]: 1, 2, 3
  • checkbox = [none]: 1
  • checkbox = 'on': 3

It's worth noting that in both versions, the "unchecked" item is consistently stored as empty string in mantis_custom_field_string_table.value

dregad

dregad

2016-09-23 08:51

developer   ~0054069

Note: I set product version to 1.3.0-rc.2, although the issue probably existed before but can't easily be reproduced due to the bug with the collapse settings cookie (0020822)

cproensa

cproensa

2019-08-20 21:45

developer   ~0062624

PR https://github.com/mantisbt/mantisbt/pull/1547

Related Changesets

MantisBT: master 1c376741

2019-08-20 17:26

cproensa

Committer: vboctor


Details Diff
Fix filtering for "none" in multivalued custom fields

- Allows to use the value "none" in custom fields of type multiselection list
- Fix the filter query for searching "none" in mutivalued custom fields
that can be empty. Those are: checkbox and multiselection list.

Fixes: 0021712, 0026030
Affected Issues
0021712, 0026030
mod - core/classes/BugFilterQuery.class.php Diff File
mod - core/filter_form_api.php Diff File