salesagility / SuiteCRM

SuiteCRM - Open source CRM for the world
https://www.suitecrm.com
GNU Affero General Public License v3.0
4.45k stars 2.08k forks source link

Country selection should be a Select Dropdown. Not an input. #8132

Open GeorgeWL opened 4 years ago

GeorgeWL commented 4 years ago

Issue

There's only a limited number of countries in the world and by being a textfield by default it causes the problem of UK, United Kingdom and the various misspellings appearing as separate entities in the data (which also applies to others of course.)

Expected Behavior

Countries should a limited field, as there are only a limited number of countries which exist, and thus spelling mistakes and initialisms get put into the data as separate entities.

Actual Behavior

There's only a limited number of countries in the world and by being a textfield by default it causes the problem of UK, United Kingdom and the various misspellings appearing as separate entities in the data (which also applies to others of course.)

Possible Fix

For data integrity wouldn't it make sense to have it behave as a drop down of all countries?

I'd suggest in the format of [Country Name (ISO 3166-1 Code)] or even to be fancy [Country Flag Icon Country Name(Country ISO Code)] for e.g. United Kingdom (GB) maybe with an optional method to edit the list in case a country changes it's name.

gunnicom commented 4 years ago

For Reference: https://github.com/salesagility/SuiteCRM/issues/1099 https://github.com/salesagility/SuiteCRM/issues/970 https://suitecrm.com/suitecrm/component/easyblog/entry/convert-the-country-text-field-in-suitecrm-to-a-drop-down-list?Itemid=435

Dillon-Brown commented 4 years ago

Thanks for the references. Taking a look at this, while it would be fairly simple to implement, the main problem is really how we would handle this on upgrade if the preferred solution is to force the existing textfield into a country list dropdown.

I don't see an easy way we could do this without risking either data loss or incorrectly updating the address field.

GeorgeWL commented 4 years ago

Maybe a opt-in feature?

Like when they build a form they get the option of "would you like to use the new Country Selector?" or something?

The other option is to just let it be a breaking fix and warn the user before they start the update process? and then require the user to fix the data...though that's not ideal.

pgorod commented 4 years ago

Due to the ease with which we can swap fields around in Studio, maybe we could just make this a new field type: country list. Then people who want this field can swap their old "free" country field for this list-limited field, and they can take care of migrating data. But we wouldn't change any existing set up automatically.

gunnicom commented 4 years ago

@pgorod Sounds nice. The problem I see on this approach is that the address template has to be adapted manually. EDIT Sorry, misread what you wrote. Forget about it :D Edit2 Upon further look, maybe still the templates ( include/SugarFields/Address/* ) have to be adapted.