View Issue Details

IDProjectCategoryView StatusLast Update
0010130mantisbtfilterspublic2015-03-23 12:27
Reporteratrol Assigned Todregad  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version1.1.6 
Target Version1.2.13Fixed in Version1.2.13 
Summary0010130: Filter "Assigned to" does not display usernames when project "All Projects" is selected
Description

I want to see all issues that are assigned to one person, who is working in more than one project. I select "All Projects" from projects. Trying this, I get no list of users in field "Assigned to"
I only get [any][none][myself] and my own username in the list.
This appears using simple and advanced filtering.

Tagspatch
Attached Files
filter-users-in-list-when-all_projects-selected.patch (4,365 bytes)   
From 66ed07f63445a6ae7884cc1a1db8ffa109d90863 Mon Sep 17 00:00:00 2001
From: Lapinkiller <lapinkiller@hotmail.fr>
Date: Tue, 14 Jun 2011 13:29:09 +0200
Subject: [PATCH] filter: users in list when all_projects selected

---
 core/filter_api.php |   22 ++++++++++++----------
 core/print_api.php  |   26 +++++++++++++++++++++++---
 2 files changed, 35 insertions(+), 13 deletions(-)

diff --git a/core/filter_api.php b/core/filter_api.php
index 7680e5b..1172f44 100644
--- a/core/filter_api.php
+++ b/core/filter_api.php
@@ -18,7 +18,7 @@
  * @package CoreAPI
  * @subpackage FilterAPI
  * @copyright Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
- * @copyright Copyright (C) 2002 - 2010  MantisBT Team - mantisbt-dev@lists.sourceforge.net
+ * @copyright Copyright (C) 2002 - 2011  MantisBT Team - mantisbt-dev@lists.sourceforge.net
  * @link http://www.mantisbt.org
  */
 
@@ -3530,21 +3530,23 @@ function print_filter_user_monitor() {
  */
 function print_filter_handler_id() {
 	global $t_select_modifier, $t_filter, $f_view_type;
+	$t_current_project = helper_get_current_project();
 	?>
 		<!-- Handler -->
 		<select <?php echo $t_select_modifier;?> name="handler_id[]">
 			<option value="<?php echo META_FILTER_ANY?>" <?php check_selected( $t_filter[FILTER_PROPERTY_HANDLER_ID], META_FILTER_ANY );?>>[<?php echo lang_get( 'any' )?>]</option>
-			<?php if( access_has_project_level( config_get( 'view_handler_threshold' ) ) ) {?>
-			<option value="<?php echo META_FILTER_NONE?>" <?php check_selected( $t_filter[FILTER_PROPERTY_HANDLER_ID], META_FILTER_NONE );?>>[<?php echo lang_get( 'none' )?>]</option>
+			<?php 
+			if( access_has_project_level(config_get( 'view_handler_threshold'))|| $t_current_project == ALL_PROJECTS) {?>
+				<option value="<?php echo META_FILTER_NONE?>" <?php check_selected( $t_filter[FILTER_PROPERTY_HANDLER_ID], META_FILTER_NONE );?>>[<?php echo lang_get( 'none' )?>]</option>
 			<?php
-								if( access_has_project_level( config_get( 'handle_bug_threshold' )) || $t_filter[FILTER_PROPERTY_HANDLER_ID][0] == ALL_PROJECTS) {
-			echo '<option value="' . META_FILTER_MYSELF . '" ';
-			check_selected( $t_filter[FILTER_PROPERTY_HANDLER_ID], META_FILTER_MYSELF );
-			echo '>[' . lang_get( 'myself' ) . ']</option>';
-		}
+				if( access_has_project_level( config_get( 'handle_bug_threshold' )) || $t_current_project == ALL_PROJECTS) {
+					echo '<option value="' . META_FILTER_MYSELF . '" ';
+					check_selected( $t_filter[FILTER_PROPERTY_HANDLER_ID], META_FILTER_MYSELF );
+					echo '>[' . lang_get( 'myself' ) . ']</option>';
+				}
 
-		print_assign_to_option_list( $t_filter[FILTER_PROPERTY_HANDLER_ID] );
-	}?>
+				print_assign_to_option_list( $t_filter[FILTER_PROPERTY_HANDLER_ID], $t_current_project);
+			}?>
 		</select>
 		<?php
 }
diff --git a/core/print_api.php b/core/print_api.php
index 704c48c..c4d9062 100644
--- a/core/print_api.php
+++ b/core/print_api.php
@@ -19,7 +19,7 @@
  * @package CoreAPI
  * @subpackage PrintAPI
  * @copyright Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
- * @copyright Copyright (C) 2002 - 2010  MantisBT Team - mantisbt-dev@lists.sourceforge.net
+ * @copyright Copyright (C) 2002 - 2011  MantisBT Team - mantisbt-dev@lists.sourceforge.net
  * @link http://www.mantisbt.org
  */
 
@@ -219,9 +219,29 @@ function print_user_option_list( $p_user_id, $p_project_id = null, $p_access = A
 		$p_project_id = helper_get_current_project();
 	}
 
-	$t_users = project_get_all_user_rows( $p_project_id, $p_access );
+	if($p_project_id === ALL_PROJECTS){
+		$t_projects = user_get_accessible_projects(auth_get_current_user_id());
 
-	# handles ALL_PROJECTS case
+		foreach($t_projects as $t_project_id){
+			$t_project_users_list = project_get_all_user_rows($t_project_id,$p_access);
+		
+			$t_users_temp = array_merge($t_users_temp,$t_project_users_list);
+		}
+		
+		$t_users_id_list = array();
+		//Remove user from list (there is a "myself" value)
+		$t_users_id_list[] = auth_get_current_user_id();
+		
+		//Deleting duplicate
+		foreach($t_users_temp as $t_user){
+			if(!in_array($t_user['id'],$t_users_id_list)){
+				$t_users_id_list[] = $t_user['id'];
+				$t_users[] = $t_user;
+			}
+		}
+	}else{
+		$t_users = project_get_all_user_rows( $p_project_id, $p_access,false );
+	}
 
 	$t_display = array();
 	$t_sort = array();
-- 
1.7.4.msysgit.0

Relationships

related to 0015721 closedgrangeway Functionality to consider porting to master-2.0.x 
has duplicate 0010280 closedatrol Option to show all users in All Projects filter 
has duplicate 0012501 closedatrol Can not use the "assigned to" filter properly when "all project" is selected 
related to 0015411 closeddregad Huge memory consumption for print_user_option_list() 
related to 0019540 acknowledged Filter "Assigned To:" doesn't show all usernames when "All Projects" is selected 

Activities

atrol

atrol

2009-10-22 10:31

developer   ~0023279

Still the same behaviour in 1.2RC2,
Maybe someone knows another way how to get this information.

dhx

dhx

2010-02-18 10:34

reporter   ~0024422

When you're reproducing this problem, how many projects do you have in your MantisBT installation?

If the answer is 1 (one), perhaps this issue is the same as 0011509 ?

atrol

atrol

2010-02-18 11:15

developer   ~0024428

The answer is 22 (5 of them as subprojects)

stevenchew

stevenchew

2010-02-18 21:26

reporter   ~0024435

Last edited: 2010-02-19 04:20

face the same issue in version 1.1.7.

I can see a list of users in "Reported" & "Monitored By" field but only 2 users in the "Assigned To" field who are administrators.

There are over 50 projects and sub projects with varying users access permissions to each projects.

stevecharon

stevecharon

2010-11-15 07:50

reporter   ~0027363

Same issue on 1.2.1 - only global developers or above are selectable in all projects view.
Having over 30 projects running - it is a pain....

cas

cas

2010-11-15 08:05

reporter   ~0027364

same in version 1.2.3, running 30 projects of which 10 sub-projects

istvanb

istvanb

2010-12-16 08:16

reporter   ~0027618

Click to the "Main" page and click the number after the "Open and assigned to me:" this will list all of your issues and also you can sort them. It would be much better though if this could be a filter option

atrol

atrol

2010-12-16 09:07

developer   ~0027619

Istvan, this is no workaround. I want to know which issues are assigned to other users.

istvanb

istvanb

2010-12-16 09:28

reporter   ~0027620

Its not, but maybe it helps for some of the users. It doesnt help if you are a manager and want to see how much issue a user has, but it help if you want to see all your issues at once.

daryn

daryn

2010-12-22 13:00

reporter   ~0027676

The problem occurs in project api function project_get_all_user_rows. If project id is ALL_PROJECTS it only checks the global level so users with a global level lower than developer but are developers or above on specific projects are excluded. The email_notify_new_account function calls this and requires using the global level only. The mc_project_get_users function also calls it and MAY require the global level. The other calls specify a project id. I wonder if we shouldn't have an ANY_PROJECT option as well as ALL_PROJECTS. This of course would likely wreak havoc through the rest of the code as ALL_PROJECTS seems to be everywhere.

Lapinkiller

Lapinkiller

2011-06-01 04:06

reporter   ~0028883

Last edited: 2011-06-08 11:08

as soon as i find time, i will submit a patch to resolve this problem ;)

EDIT : patch submitted

Lapinkiller

Lapinkiller

2011-06-14 07:32

reporter   ~0028993

Sorry, show-users-in-userlist-selection-when-ALL-PROJECTS-.patch doesn't work.

use filter-users-in-list-when-all_projects-selected.patch instead.

(@admins please delete first patch)

quentinbes

quentinbes

2011-06-15 09:34

reporter   ~0029003

Thank you for the patch but it doesn't work for me.
I'm the only one to have some trouble ?

Lapinkiller

Lapinkiller

2011-06-15 10:57

reporter   ~0029007

Last edited: 2011-06-15 11:06

which patch have you used ? the first one i have submitted (and which is not longer attached to this bug) : show-users-in-userlist-selection-when-ALL-PROJECTS-.patch or the second : filter-users-in-list-when-all_projects-selected.patch ?

NB : the patch is for mantis 1.2.5

quentinbes

quentinbes

2011-06-16 03:36

reporter   ~0029015

I used the second one but my mantis version is 1.2.3.
I tried to insert changes described in the .patch file in the source code without using git (manually).

Do you think the version I use is in conflict with your patch ?

Lapinkiller

Lapinkiller

2011-06-16 03:59

reporter   ~0029016

maybe, i don't know...

can you try to upgrade your mantis or a copy of your mantis to 1.2.5 ?

M.C.S.

M.C.S.

2012-05-21 03:09

reporter   ~0031872

push
When will this patch make it into the official 1.2.x branch? Does it need testing? Can I help with it?

dregad

dregad

2012-05-21 05:01

developer   ~0031875

@M.C.S.

Does it need testing? Can I help with it?

Yes, and yes.

Please report details of your test cases and results here. You should ensure the fix works as it should, and does not cause any regression issues (filter api is quite complex, so be careful).

One of the developers can then review the results and push the commit.

M.C.S.

M.C.S.

2012-09-24 05:10

reporter   ~0032923

Well, I tried to apply the patch under Windows XP with "git version 1.7.8.msysgit.0" on branch "master-1.2.x" and also on the clean "release-1.2.5", but I always get these error messages when trying to apply the patch:

$git apply --check ../filter-users-in-list-when-all_projects-selected.patch
error: patch failed: core/filter_api.php:18
error: core/filter_api.php: patch does not apply
error: patch failed: core/print_api.php:19
error: core/print_api.php: patch does not apply

I called the git command from within my MantisBT root folder. Anything wrong on that?

Lapinkiller

Lapinkiller

2012-09-24 09:27

reporter   ~0032924

Last edited: 2012-09-24 09:28

i have made a new patch based on 1.2.11/1.2.x (the patch attached here was for 1.2.5 and not fully working...)
github pull request : https://github.com/mantisbt/mantisbt/pull/61

Lapinkiller

Lapinkiller

2012-10-03 05:27

reporter   ~0033009

have you seen my patch/pull request ?

dregad

dregad

2012-10-03 05:49

developer   ~0033015

yes but did not have time to test it yet

Lapinkiller

Lapinkiller

2012-10-03 07:50

reporter   ~0033018

ok, no problem, i just wasn't sure you have seen it ^^

dregad

dregad

2012-12-12 13:06

developer   ~0034537

I merged (& squashed) your commit, then made some improvements - see https://github.com/dregad/mantisbt/tree/fix-10130

atrol

atrol

2012-12-14 03:21

developer   ~0034539

Last edited: 2012-12-14 03:22

Removing the current user from list is no good idea as we lose functionality.
Creating a permalink with [Myself] (handler_id = -1) and use it by another user is another thing than using a specific handler_id in link.

dregad

dregad

2012-12-14 06:50

developer   ~0034540

Good point, did not think about that. I'll revert the change.

Related Changesets

MantisBT: master-1.2.x 21746dd1

2012-09-24 09:19

JGuilbaud

Committer: Damien Regad


Details Diff
Show all users in assign filter when ALL PROJECTS is selected

Fixes 0010130

Signed-off-by: Damien Regad <damien.regad@merckgroup.com>
Affected Issues
0010130
mod - core/filter_api.php Diff File
mod - core/print_api.php Diff File

MantisBT: master 048dc22c

2012-09-24 09:19

JGuilbaud

Committer: Damien Regad


Details Diff
Show all users in assign filter when ALL PROJECTS is selected

Fixes 0010130

Signed-off-by: Damien Regad <damien.regad@merckgroup.com>
Affected Issues
0010130
mod - core/filter_api.php Diff File
mod - core/print_api.php Diff File

MantisBT: master-1.2.x dab0021e

2012-12-12 12:39

dregad


Details Diff
Optimise code in print_user_option_list()

Improve performance of code building the list of users for all projects
introduced in commit 21746dd1a6a7e4c6df8baa9cbfc3dac48c82899c.

By using an associative array, the foreach loop to remove duplicates can
be simplified (no need for an if statement) and we can also remove the
current user from the list more easily.

Affects issue 0010130
Affected Issues
0010130
mod - core/print_api.php Diff File

MantisBT: master dba4f3e5

2012-12-12 12:39

dregad


Details Diff
Optimise code in print_user_option_list()

Improve performance of code building the list of users for all projects
introduced in commit 21746dd1a6a7e4c6df8baa9cbfc3dac48c82899c.

By using an associative array, the foreach loop to remove duplicates can
be simplified (no need for an if statement) and we can also remove the
current user from the list more easily.

Affects issue 0010130
Affected Issues
0010130
mod - core/print_api.php Diff File

MantisBT: master-1.2.x 748c4cec

2012-12-12 12:56

dregad


Details Diff
Removing current user from list built by print_user_option_list()

Since there is a [myself] value in the list, the current user should be
removed. This was done for ALL_PROJECTS with the fix for issue 0010130,
but the single-project code still listed the current user.

By moving the code to remove the current user to the foreach loop that
builds the sort arrays, we ensure that it is removed in both cases.
Affected Issues
0010130
mod - core/print_api.php Diff File

MantisBT: master c7e261e1

2012-12-12 12:56

dregad


Details Diff
Removing current user from list built by print_user_option_list()

Since there is a [myself] value in the list, the current user should be
removed. This was done for ALL_PROJECTS with the fix for issue 0010130,
but the single-project code still listed the current user.

By moving the code to remove the current user to the foreach loop that
builds the sort arrays, we ensure that it is removed in both cases.
Affected Issues
0010130
mod - core/print_api.php Diff File

MantisBT: master-1.2.x 07351732

2012-12-14 08:37

dregad


Details Diff
Do not remove current user from list

As mentioned by atrol in issue 0010130, removing the current user causes
potential loss of functionality when using filters because [myself]
(handler_id = -1) is not the same as a specific handler_id.

This is a partial revert of 748c4cec6457475673f21ad554ba1791c90222c7.
Affected Issues
0010130
mod - core/print_api.php Diff File

MantisBT: master 0dfe2549

2012-12-14 08:37

dregad


Details Diff
Do not remove current user from list

As mentioned by atrol in issue 0010130, removing the current user causes
potential loss of functionality when using filters because [myself]
(handler_id = -1) is not the same as a specific handler_id.

This is a partial revert of 748c4cec6457475673f21ad554ba1791c90222c7.
Affected Issues
0010130
mod - core/print_api.php Diff File