I need a filter where i can bring the bugs from a specific project and a specific user

Post about your customizations to share with others.

Moderators: Developer, Contributor

Post Reply
nalzate
Posts: 22
Joined: 05 Dec 2023, 20:47
Location: Colombia

I need a filter where i can bring the bugs from a specific project and a specific user

Post by nalzate »

I need a filter where I can bring the bugs from a specific project and a specific user, the current version allows me to filter by project and user who made the report in: filter_create_reported_by( $p_project_id, $p_user_id ); and filter by project and user who has assigned the bug in: filter_create_assigned_to_unresolved( $p_project_id, $p_user_id ); but there is no filter that joins me both functions where I can have from a project the bugs with users that report or have assigned,

I tried to create a custom filter with

$t_filter[FILTER_PROPERTY_HANDLER_ID] = array( '0' => $p_user_id );
$t_filter[FILTER_PROPERTY_REPORTER_ID] = array( '0' => $p_user_id );


But it brings me the bugs that the specific user has but where at the same time is informer and assigned.

I need your help please!! Thanks!
cas
Posts: 1622
Joined: 11 Mar 2006, 16:08
Contact:

Re: I need a filter where i can bring the bugs from a specific project and a specific user

Post by cas »

did you check the advanced filter options? Click in the top right corner (of the view all bugs age) next to the chevron...
nalzate
Posts: 22
Joined: 05 Dec 2023, 20:47
Location: Colombia

Re: I need a filter where i can bring the bugs from a specific project and a specific user

Post by nalzate »

Hello good afternoon,
I did use that advanced filtering functionality but it does not solve my problem. The problem is that when the filter is made placing the same person as informant and at the same time as who has assigned the bug it shows me the cases that meet that restriction, I guess the query that is created for that filter comes with an AND in the database and I need is that it brings the bugs where the person appears as informant OR assigned.

The SQL query I need is the following:


SELECT id from mantis_bug_table where handler_id = (SELECT id from mantis_user_table where username = "username") or reporter_id = (SELECT id from mantis_user_table where username = "username")


"username" = is the user ID
atrol
Site Admin
Posts: 8378
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: I need a filter where i can bring the bugs from a specific project and a specific user

Post by atrol »

Set "Match Type" to "Any Condition"
Please use Search before posting and read the Manual
nalzate
Posts: 22
Joined: 05 Dec 2023, 20:47
Location: Colombia

Re: I need a filter where i can bring the bugs from a specific project and a specific user

Post by nalzate »

Umm, I don't understand what you are telling me. Can you please be more specific?
atrol
Site Admin
Posts: 8378
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: I need a filter where i can bring the bugs from a specific project and a specific user

Post by atrol »

You can set the "Match Type" in the last row of the filter section
Screenshot 2024-03-11 at 20-24-24 View Issues - MantisBT.png
Screenshot 2024-03-11 at 20-24-24 View Issues - MantisBT.png (2.49 KiB) Viewed 1150 times
Please use Search before posting and read the Manual
nalzate
Posts: 22
Joined: 05 Dec 2023, 20:47
Location: Colombia

Re: I need a filter where i can bring the bugs from a specific project and a specific user

Post by nalzate »

we are creating a function, not using the filters on the view

we are using the following variables:

$t_filter[FILTER_PROPERTY_REPORTER_ID] and $t_filter[FILTER_PROPERTY_HANDLER_ID]


I want to know which variable you are using in the "any condition".
atrol
Site Admin
Posts: 8378
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: I need a filter where i can bring the bugs from a specific project and a specific user

Post by atrol »

I thought you used it based on the question from cas
cas wrote: 05 Mar 2024, 14:46 did you check the advanced filter options? Click in the top right corner (of the view all bugs age) next to the chevron...
and
nalzate wrote: 08 Mar 2024, 22:10 I did use that advanced filtering functionality but it does not solve my problem.
If it works the way you expect in UI, it should also work by setinng
FILTER_PROPERTY_MATCH_TYPE to FILTER_MATCH_ANY
Please use Search before posting and read the Manual
nalzate
Posts: 22
Joined: 05 Dec 2023, 20:47
Location: Colombia

Re: I need a filter where i can bring the bugs from a specific project and a specific user

Post by nalzate »

Inside the function I created to list the bugs for a specific user (bugs assigned to that user or bugs where the user is the one reporting) and a specific project, I am using the following functions:


$t_filter = filter_get_default();

if( $p_user_id == 0 ) {
$t_filter[FILTER_PROPERTY_HANDLER_ID] = array( '0' => META_FILTER_NONE );
} else {
$t_filter[FILTER_PROPERTY_HANDLER_ID] = array( '0' => $p_user_id );
}

$t_filter[FILTER_PROPERTY_REPORTER_ID] = array( '0' => $p_user_id );
$t_filter[FILTER_PROPERTY_MATCH_TYPE] = array( '0' => FILTER_MATCH_ANY);

$t_bug_resolved_status_threshold = config_get( 'bug_resolved_status_threshold', null, $p_user_id, $p_project_id );
$t_filter[FILTER_PROPERTY_HIDE_STATUS] = array( '0' => $t_bug_resolved_status_threshold );

if( $p_project_id != ALL_PROJECTS ) {
$t_filter[FILTER_PROPERTY_PROJECT_ID] = array( '0' => $p_project_id );
}

return filter_ensure_valid_filter( $t_filter );


Is this correct?
Post Reply