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

State Filed population issue #177

Open
rbaugh opened this issue Aug 27, 2020 · 3 comments
Open

State Filed population issue #177

rbaugh opened this issue Aug 27, 2020 · 3 comments

Comments

@rbaugh
Copy link

rbaugh commented Aug 27, 2020

I think I have come across an issue with the State/Province population function in the helper file. The logic is checking for the countryLimit setting from CiviCRM. Teh CiviCRM notes states that if you don't want to limit any countries, to leave the right side select field empty. But, this is causing the check on line 294 to essentially unset all state/province results from CiviCRM. It seems like there should be a check, before iterating over all of the state/province items, to see if the countryLimit is empty and if so, skip the foreach loop.

if ( ! in_array( $state['country_id'], $this->get_civicrm_settings( 'countryLimit' ) ) ) {

Screen Shot 2020-08-27 at 3 11 52 PM

@rgilman
Copy link

rgilman commented Oct 9, 2020

I've run into the same issue, as discussed on the civicrm stackexchange..

I agree that the logic around the 293-297 foreach loop needs to be improved to handle the case where all countries are included by leaving the right-hand boxes for available countries and available states empty (as CiviCRM instructs).

@agileware-justin
Copy link

@rgilman Agree too. This would be a welcome improvement as the current behaviour is somewhat confusing and counter to CiviCRM's default functionality.

I'll bug this one internally, find an Agileware team member to review and submit PR. Agileware Ref: CFC-71 (our internal task).

@andyburnsco
Copy link

@rgilman just FYI your workaround doesn't appear to be working anymore :( In wanting to have all countries show in Caldera Forms we had to enable each country in CiviCRM localization settings (admittedly not a nice workaround). However, in extensive testing, we found a significant slowness when using the CiviCRM State/Province field, most pronounces with all countries enabled but still sluggish with just United States. TTFB was 4.3s all countries enabled, 2.6s just United States enabled. 1.6s with solution below.

If you use a select dropdown field in Caldera and bulk insert the states/provinces you want in the following format:

image

Just export as CSV the countries you want from civicrm_state_province table and then separate with | so using the US as an example would be:

1000|Alabama
1001|Alaska
1002|Arizona
1003|Arkansas
1004|California
1005|Colorado
1006|Connecticut
1007|Delaware
1008|Florida
1009|Georgia
1010|Hawaii
1011|Idaho
1012|Illinois
1013|Indiana
1014|Iowa
1015|Kansas
1016|Kentucky
1017|Louisiana
1018|Maine
1019|Maryland
1020|Massachusetts
1021|Michigan
1022|Minnesota
1023|Mississippi
1024|Missouri
1025|Montana
1026|Nebraska
1027|Nevada
1028|New Hampshire
1029|New Jersey
1030|New Mexico
1031|New York
1032|North Carolina
1033|North Dakota
1034|Ohio
1035|Oklahoma
1036|Oregon
1037|Pennsylvania
1038|Rhode Island
1039|South Carolina
1040|South Dakota
1041|Tennessee
1042|Texas
1043|Utah
1044|Vermont
1045|Virginia
1046|Washington
1047|West Virginia
1048|Wisconsin
1049|Wyoming
1050|District of Columbia
1052|American Samoa
1053|Guam
1055|Northern Mariana Islands
1056|Puerto Rico
1057|Virgin Islands
1058|United States Minor Outlying Islands
1059|Armed Forces Europe
1060|Armed Forces Americas
1061|Armed Forces Pacific

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

No branches or pull requests

4 participants