Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev/core#142 Add chain select to state and counties in Search Builder #12213

Merged
merged 1 commit into from
May 28, 2018

Conversation

monishdeb
Copy link
Member

Overview

The Search Builder state and county fields don't filter with reference to the country or state fields that are within the same AND grouping. The state field displays the states from the countries that have states enabled, and the county field displays all counties in alphabetical order.

Proposal:

  1. Make the states drop-down depend upon a country of the same location type, within the same "AND" grouping. Do the same for the counties with regard to the states. This would require some kind of parameter to be sent to the address/getoptions API to filter the list, but it would make them work in the same way as elsewhere in CiviCRM.
  2. If there are no counties present for a state or no state present for a country, then render empty select list.

Before

State/Counties don't reload on changing country/state respectively in Search builder for same location type.

After

State/Counties reload on changing country/state respectively in Search builder for same location type (here as per screencast check that two location type used Home and Billing)
test-multiple-after

@monishdeb
Copy link
Member Author

ping @colemanw @agh1 @lcdservices

@colemanw
Copy link
Member

This looks great @monishdeb

@colemanw colemanw merged commit f75dfe2 into civicrm:master May 28, 2018
@MegaphoneJon
Copy link
Contributor

@monishdeb you say, "Make the states drop-down depend upon a country of the same location type". Does this imply that the country field is now a required field to search by state/province in Search Builder?

@agh1
Copy link
Contributor

agh1 commented May 29, 2018

@MegaphoneJon just looking at it in the demo site, it appears that you can use the State/Province on its own, but the choices are limited to the countries you've enabled for showing states--similar behavior to a profile with State/Province but not Country.

I don't think this is necessarily a problem, but it is a key change that wasn't documented.

@monishdeb monishdeb deleted the dev_core_142 branch May 29, 2018 15:22
@agh1
Copy link
Contributor

agh1 commented May 29, 2018

@monishdeb @colemanw In playing around with this, I did find a somewhat serious problem: when a Country field changes, all State/Province fields with that location type change their options, even within other "Also include contacts where" groupings. To recreate, let's say you are planning an event in Detroit:

  1. Search for contacts in Michigan:

    Contacts | Country | Home | = | United States
    Contacts | State | Home | = | Michigan
    
  2. Search for contacts in Ontario by clicking "Also include contacts where" and setting up:

    Contacts | Country | Home | = | Canada
    Contacts | State | Home | = | Ontario
    

Notice that the state dropdown where Michigan had been selected now has nothing selected and offers only Canadian provinces.

@monishdeb
Copy link
Member Author

Thanks @colemanw for merging this PR.

@MegaphoneJon not quite, I would say on presence of country field IF there is a state filter selected which got same location type as of country, it will reload the select list as per selected country. If there is no country present, state will simply populate the states of default country configured. And I agree I should have documented this fact in my PR description.

@agh1 if you find any other issue/miss please create a separate issue and assign to me and thanks for your feedback :)

@monishdeb
Copy link
Member Author

monishdeb commented May 29, 2018

@agh1 so as per the expected behaviour I think change on country field should only affect the block where the selection made? Like here it shouldn't affect the state field under "Also include contacts where" block but all state fields under "Include contacts where" block?

@agh1
Copy link
Contributor

agh1 commented May 29, 2018

@monishdeb exactly--the markup looks like each section is in its own div with the class crm-search-block, which may help with narrowing the selector.

@monishdeb
Copy link
Member Author

Yup agree, would you like to create a issue on gitlab and assign it to me?

@agh1
Copy link
Contributor

agh1 commented May 29, 2018

@monishdeb no prob. I opened dev/core#150 though I can't change assignments.

@colemanw
Copy link
Member

Good catch. Thanks @agh1

@colemanw
Copy link
Member

colemanw commented Jun 8, 2018

@agh1 can you please check #12230

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants