Problem/Motivation

When filtering by contacts or organizations that include an address field, contacts for countries other than the default country are never show.

This bug results from changes in #1801390: Use native field API to generate filters in redhen_filter_form. Because the AJAX operation triggered when the country was changed on an address broke form submission, the country select was hidden (access = FALSE). However, this means that a country is still assumed, and because it cannot be selected, the default site country (if set) is used.

Proposed resolution

There are two distinct problems here.

Problem 1: A country is always selected, meaning it's never possible to show contacts from all countries.

Possible fixes:

  1. Add an "Any" country option so that it's possible to skip the country filter.

Problem 2: The default country is always selected.

Possible fixes:

  1. Troubleshoot and fix the AJAX callback issue so that regular address functionality is restored.
  2. Restore access to the country select but limit it to "Any" or the default country, with "Any" the default.
  3. Restore access to the country select and allow all options. The form will be semi-broken, however, as it won't be rewritten to be appropriate for the selected country.

Clearly option 1 here is preferable, but 2 might be an acceptable short term workaround.

Comments

nedjo’s picture

Looked at this but didn't get far. On the contact filter form, the ajax issue appears only when there are multiple contact types. With a single type it works fine.

Attached patch adds an "Any" option and restores access to the country select but limits it to "Any" or the default country.

But on my testing this isn't working. If I select Any, I get no matches. I have to submit the form a second time - with no changed values - to get any results. Although the form input hasn't changed, the GET values in the URL differ between these two submits, with the first one reflecting stale data. These issues likely reflect larger problems not specifically related to address fields.

levelos’s picture

Status: Active » Needs work
nedjo’s picture

Unless someone has time to dig into this, likely the best short term approach is to implement a whitelist of field types, excluding address for now. Then reintroduce address field support when there's a working implementation.

nedjo’s picture

Issue summary: View changes

Fix incomplete sentence.

johnkingeu’s picture

Title: Redhen filtering assumes default country » Redhen filtering requires default

redhen assumes a default for all fields, not just country. For example, if a file or image field has been added to the contact bundle, searches return nothing.

levelos’s picture

Status: Needs work » Fixed

See d029a85 for at least a temporary solution. It provides an alterable blacklist of filterable field types, which are excluded from all RedHen filter forms.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.