View Issue Details Jump to Notes ] Wiki ] Related Changesets ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007809mantisbtcustom fieldspublic2007-03-09 03:082007-10-04 01:37
Assigned Togiallu 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version1.1.0rc1 
Summary0007809: Filter "none" on custom fields doesn't work
DescriptionWhen filtering on a custom field and choosing the value [none], the result is empty.

The reason is that there's no entry in the mantis_custom_field_string_table for empty lines (except if the field was first filled and then updated to empty).
Steps To ReproducePre-requisites :
1 - Create a custom field as administrator in [Manage custom fields]
2 - Add this custom field to a project in [Manage project]
3 - Create an anomaly in this project and let the custom field empty

Reproducing :
1 - In view issues, select [none] as the value to filter on for this field
2 - Click on Apply Filter
3 - See the empty result
Additional InformationThis could be solved by a special query for the [none] value like :

SELECT ... FROM mantis_bug_table WHERE bug_id NOT IN (SELECT DISTINCT(bug_id) FROM mantis_custom_field_string_table WHERE field_id="...")
TagsNo tags attached.
Attached Filespatch file icon custom_field_filter_none.patch [^] (1,129 bytes) 2007-03-09 04:47 [Show Content]
patch file icon custom_field_filter_none_2.patch [^] (1,144 bytes) 2007-03-09 05:25 [Show Content]
patch file icon bug7809.patch [^] (2,563 bytes) 2007-07-16 18:43 [Show Content]

- Relationships

-  Notes
User avatar (0014148)
lifo2 (reporter)
2007-03-09 04:50

Here is a patch that correct this problem.

In fact, there were two problems :

 - no line in the table for bug added before the custom field was added in the project (solved thanks to the SELECT ... WHERE id NOT IN (...))

 - no result at all because of a wrong comparison between META_FILTER_NONE and $t_filter_member
User avatar (0014149)
lifo2 (reporter)
2007-03-09 05:26

Sorry, I made a mistake in the first patch. The second one is the good one.
User avatar (0015070)
giallu (developer)
2007-07-16 18:42

I finally had a chance at reviewing your patch.
You are definitely right on the diagnosis and the proposed fix works, but I reworked the patch a little becasue I did not like too much the $t_first_time usage (I know, it's not your faukt since you copy/paste it...) I'm attaching the reworked patch here, please test it and let me know if it also works for you.

One question; the query you proposed in "Additional Information" had a DISTINCT clause: is there a reason why you dropped it in the proposed patch?
User avatar (0015626)
lifo2 (reporter)
2007-09-13 10:05

It seems fine to me (and yes, the use of an array and implode is more elegant ;) ).

I think I dropped the DISTINCT clause because there can be only one row for a given couple of bug_id and field_id, so it was useless.
User avatar (0015629)
giallu (developer)
2007-09-13 13:24

In the meanwhile, I become aware thart the nested query syntax could be problematic for the cross DB goal of mantis (and even in MySQL was introduced in v4.1, while we are going to require 4.0)

Do you think that doing 2 separate queries would be detrimental to performances and/or RAM usage?
User avatar (0015632)
jreese (reporter)
2007-09-13 15:41

@giallu: I thought we were going to be requiring MySQL 4.1 specifically for the reason of subquery support?
User avatar (0015635)
giallu (developer)
2007-09-14 02:23

I will ask again on -devel
User avatar (0015639)
exk72 (reporter)
2007-09-14 20:14

Shouldn't / doesn't ADODB handle subquery support?
User avatar (0015640)
giallu (developer)
2007-09-15 03:55

I wish I knew...

anyway, Victor gave me the OK to use subqueries, so 1.1 will have a dependency on MySQL 4.1 and I can commit the fix as is.

- Related Changesets
MantisBT: master bd7cad4f
Timestamp: 2007-09-15 21:48:26
Author: giallu
Details ] Diff ]
Fix 7809: Filter "none" on custom fields doesn't work

git-svn-id: [^] /?p=mantisbt.git;a=object;h=f5dc347c-c33d-0410-90a0-b07cc1902cb9
mod - core/filter_api.php Diff ] File ]

- Issue History
Date Modified Username Field Change
2007-03-09 03:08 lifo2 New Issue
2007-03-09 04:47 lifo2 File Added: custom_field_filter_none.patch
2007-03-09 04:50 lifo2 Note Added: 0014148
2007-03-09 05:25 lifo2 File Added: custom_field_filter_none_2.patch
2007-03-09 05:26 lifo2 Note Added: 0014149
2007-07-02 11:41 giallu Status new => assigned
2007-07-02 11:41 giallu Assigned To => giallu
2007-07-16 18:42 giallu Note Added: 0015070
2007-07-16 18:43 giallu File Added: bug7809.patch
2007-09-13 10:05 lifo2 Note Added: 0015626
2007-09-13 13:24 giallu Note Added: 0015629
2007-09-13 15:41 jreese Note Added: 0015632
2007-09-14 02:23 giallu Note Added: 0015635
2007-09-14 20:14 exk72 Note Added: 0015639
2007-09-15 03:55 giallu Note Added: 0015640
2007-09-15 17:54 giallu Status assigned => resolved
2007-09-15 17:54 giallu Fixed in Version => 1.1.0rc1
2007-09-15 17:54 giallu Resolution open => fixed
2007-10-04 01:37 vboctor Status resolved => closed
2008-10-20 20:21 Changeset attached master-1.1.x 148b3cce =>
2008-11-11 08:35 giallu Changeset attached master bd7cad4f =>
2008-11-11 08:48 giallu Changeset attached master bd7cad4f =>

MantisBT 1.2.17 [^]
Copyright © 2000 - 2014 MantisBT Team
Time: 0.1146 seconds.
memory usage: 3,073 KB
Powered by Mantis Bugtracker