Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-17707

Establish standard state/province IDs

    Details

    • Versioning Impact:
      Patch (backwards-compatible bug fixes)
    • Documentation Required?:
      Developer Doc
    • Funding Source:
      Needs Funding

      Description

      The most recent civicrm_state_province entries (since CRM-6198: https://github.com/civicrm/civicrm-core/blob/4.7.beta2/xml/templates/civicrm_state_province.tpl#L3732) have installed without a fixed ID. I suspect this is because many sites add a number of custom states: while many countries have states defined in ISO 3166-2, a number of countries don't--most prominently, the UK (see CRM-9243, CRM-17706, and others). If someone with custom states ran an upgrade declaring the Abaco Islands to be 10028, the IDs would probably clash. Allowing the field to auto-increment dodges this issue.

      However, if you want to ship a county extension like US County Loader or one of the several custom ones that NDI has built, you need to know the state_province_id.

      I think the solution would be to have standard IDs for civicrm_state_province, plus a band of open IDs where non-standard IDs could be saved. To do so, an upgrade script would need to be written that sorts out the IDs and all the references to them.

      Alternatively, we could decide that state_province_id is totally arbitrary and variable site-to-site, and folks dealing with them will just have to do lookups via the combination of country and state abbreviation.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              andrewhunt Andrew Hunt
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: