Page 1 of 1
I need a filter where i can bring the bugs from a specific project and a specific user
Posted: 29 Feb 2024, 23:08
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!
Re: I need a filter where i can bring the bugs from a specific project and a specific user
Posted: 05 Mar 2024, 14:46
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...
Re: I need a filter where i can bring the bugs from a specific project and a specific user
Posted: 08 Mar 2024, 22:10
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
Re: I need a filter where i can bring the bugs from a specific project and a specific user
Posted: 08 Mar 2024, 22:49
by atrol
Set "Match Type" to "Any Condition"
Re: I need a filter where i can bring the bugs from a specific project and a specific user
Posted: 11 Mar 2024, 19:16
by nalzate
Umm, I don't understand what you are telling me. Can you please be more specific?
Re: I need a filter where i can bring the bugs from a specific project and a specific user
Posted: 11 Mar 2024, 19:26
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 (2.49 KiB) Viewed 18118 times
Re: I need a filter where i can bring the bugs from a specific project and a specific user
Posted: 11 Mar 2024, 19:34
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".
Re: I need a filter where i can bring the bugs from a specific project and a specific user
Posted: 11 Mar 2024, 19:47
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
Re: I need a filter where i can bring the bugs from a specific project and a specific user
Posted: 15 Mar 2024, 22:29
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?