taskadapter / redmine-java-api

Redmine Java API
Apache License 2.0
270 stars 163 forks source link

filter by customField and status #339

Open vvmsalat opened 4 years ago

vvmsalat commented 4 years ago

I cannot filter issues by multiple parameters. Either they can be filtered by status, or by only one CustomField. Putting them together as below only filters the first added param, here "cf_8".

  Params params = new Params()
            .add("project_id", projectKey)
            .add("set_filter", "1") // needed?
            .add("limit", "5000")
            .add("offset", "0")
            .add("f[]", "cf_8") // key
            .add("op[cf_8]", "~")
            .add("v[cf_8][]", "Strassenbezeichnung")
            .add("f[]", "cf_13") // gemeinde
            .add("op[cf_13]", "=")
            .add("v[cf_13][]", "gemeindename")
            .add("f[]", "status_id") 
            .add("op[status_id]", "=")
            .add("v[status_id]", "1");

    ResultsWrapper rwIssues = mgr.getIssueManager().getIssues(params);
    List<Issue> issues = rwIssues.getResults();

Tried it with the actual redmine api 4.0. I'm sure, it should work, what's the matter?

vvmsalat commented 4 years ago

the problem occurs in class URIConfigurator > createURI > distinct "f[]" has to be maintained for each filter paramter

https://github.com/taskadapter/redmine-java-api/blob/bb8acb645ac3e295c3ff328d319a42139e0e56e3/src/main/java/com/taskadapter/redmineapi/internal/URIConfigurator.java#L101