View Issue Details

IDProjectCategoryView StatusLast Update
0016358mantisbtfilterspublic2017-10-08 23:52
ReportertniemiAssigned Tocproensa 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version1.2.15 
Target Version2.7.0Fixed in Version2.7.0 
Summary0016358: Custom field filter does not recusrively read all items from sub-projects
Description

Filter combo box does not include custom field strings from the sub-projects.

Steps To Reproduce

Create project stucture:
-Test_root
--TestSub1
--TestSub2

Define Custom field (String) to all projects. Create issue to all projects and define unique value for each issue per each project.

Select project Test_root, View Issues and open filter for a custom field. Filter combobox will contain only items from Test_root and sub-projects are excluded. This is not logical to user because Mantis Issues are shown recursively when Test_root is selected.

Additional Information

core/custom_field_api.php function custom_field_distinct_values() does not go though the sub project when ALL_PROJECTS != $p_project_id

TagsNo tags attached.

Relationships

has duplicate 0013978 closedcproensa Customs fields combo box are filled using the selected project at the top, even if you use advanced filtering. 
child of 0023443 closedcproensa Fixes related to custom fields on filters, columns and visibility 

Activities

tniemi

tniemi

2014-04-24 03:57

reporter   ~0040156

As a workaround used this patch.

Please note that this does not work if custom field is not linked in parent project. It work only when parent has custom field enabled and it will lookup the same custom fields from any subproject.

--- core/custom_field_api.php.orig      2013-10-25 10:49:53.119000030 +0300
+++ core/custom_field_api.php   2013-10-25 13:42:53.670995952 +0300
@@ -1153,8 +1153,27 @@

                if( ALL_PROJECTS != $p_project_id ) {
                        $t_from .= " JOIN $t_mantis_bug_table bt ON bt.id = cfst.bug_id";
-                       $t_where2 = 'AND bt.project_id = ' . db_param();
-                       $t_params[] = $p_project_id;
+                       $t_subprojects = project_hierarchy_get_all_subprojects($p_project_id);
+                       if(count($t_subprojects) > 0)
+                       {
+                               # Add subprojects to where clause
+                               $t_where2 = 'AND (bt.project_id = ' . db_param();
+                               $t_params[] = $p_project_id;
+
+                               # Go also for each subprojects
+                               foreach( project_hierarchy_get_all_subprojects($p_project_id) as $t_subproject_id )
+                               {
+                                       $t_where2 .= " OR bt.project_id = "  . db_param();
+                                       $t_params[] = $t_subproject_id;
+                               }
+                               $t_where2 .= ")";
+                       }
+                       else
+                       {
+                               # No sub projects exist
+                               $t_where2 = 'AND bt.project_id = ' . db_param();
+                               $t_params[] = $p_project_id;
+                       }
                } else {
                        $t_where2 = '';
                }

Related Changesets

MantisBT: master 19fb937b

2017-08-15 19:36:17

cproensa


Committer: dregad Details Diff
Get custom fields values from a list of projects

Extend custom_field_distinct_values() to allow a list of projects to get
values from.
Extend the custom fields filter input to show values from all the
projects included in the filter scope, which may also include
subprojects.

Fixes: 0016358
mod - core/custom_field_api.php Diff File
mod - core/filter_form_api.php Diff File

Issue History

Date Modified Username Field Change
2013-09-04 08:36 tniemi New Issue
2014-04-24 03:57 tniemi Note Added: 0040156
2017-08-16 13:20 cproensa Assigned To => cproensa
2017-08-16 13:20 cproensa Status new => assigned
2017-08-19 21:26 cproensa Relationship added has duplicate 0013978
2017-10-07 12:45 dregad Changeset attached => MantisBT master 19fb937b
2017-10-07 12:45 cproensa Status assigned => resolved
2017-10-07 12:45 cproensa Resolution open => fixed
2017-10-07 12:45 cproensa Fixed in Version => 2.7.0
2017-10-07 13:34 atrol Target Version => 2.7.0
2017-10-08 11:49 cproensa Relationship added child of 0023443
2017-10-08 23:52 vboctor Status resolved => closed