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

213 select country #214

Closed

Conversation

balazstar
Copy link
Contributor

Hi,

I have created this pull request based on our discussion on issue #213.

I have also added the rake task for data upgrade. (this can be possibly written for faster execution, if needed)

Please examine with care, this request changes the format how ffcrm stores countries.
A bug can cause data loss for users.

If any questions arise, feel free to contact me.

Cheers,
Balázs

P.S.: The requested, storing preferred countries in settings file, will come in a separate request.

@steveyken
Copy link
Member

Thanks for this. I've merged your changes into a country_select branch ( see https://github.com/fatfreecrm/fat_free_crm/tree/country_select )

I've also added a 'preferred_countries' option to the address helper and settings file.

Now that I'm looking at the script, I'm wondering if there are will be conversion clashes when the rake task is run... e.g. someone chose Australia (incorrectly marked as 'AT') prior to this work, but now it will display as 'Austria' instead. The rake script won't currently auto-migrate this as it's only looking for country names, not bad ISO's.

I think we should fix that by enumerating all the existing errors and then encourage people to update and run the country rake script.

By the way, was the country_select really badly wrong in many cases? Or did they use a different ISO standard?

Also, I'm wondering if, in the near future, we should consider moving to a more first class country model so that addresses can easily extract the country name. Currently there is no way to get at the country list from outside the FormHelper.

Anyway, that's for later.

Thanks again for your work here, it's much appreciated.

@balazstar
Copy link
Contributor Author

Thanks for adding the settings.

I am not sure what you mean by
"I'm wondering if there are will be conversion clashes when the rake task is run... e.g. someone chose Australia (incorrectly marked as 'AT') prior to this work, but now it will display as 'Austria' instead."

The convert_table array in the rake task contains the old and the new code of a country.
Country names are not used while running the task, it is only there for clarity.
so for example
Australia was AS now it will be AU
Austria was AU now it will be AT

The only place where I see problems where the old country codes are the same
like:
"Finland", "FI",
"Aland Islands", "FI"
However since Finland was a priority country it was stored as Finland and not as FI

About the ISO codes,
I am not sure where they come in the first place.
Neither does
https://github.com/rails/country_select/blob/master/lib/country_select.rb
or
https://github.com/jamesds/country-select/blob/master/lib/country-select.rb
have them.

Thanks for the help and guidance, it is really appreciated.

@steveyken
Copy link
Member

My bad, I think all you've done is right. Australia was 'AS' in the old system and in the new it is corrected to "AU" so there won't be a problem. I'm hoping to incorporate this tomorrow.

@balazstar
Copy link
Contributor Author

Great to hear that. :)

@steveyken
Copy link
Member

Pushed to master as of c805554 Thanks for your help!

@steveyken steveyken closed this Dec 21, 2012
@balazstar balazstar deleted the 213_select_country branch December 26, 2012 18:50
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

Successfully merging this pull request may close these issues.

2 participants