Disambiguate `Address.state_province_id:abbr` (MySQL; simpler version)
authorTim Otten <totten@civicrm.org>
Fri, 10 Feb 2023 22:40:55 +0000 (14:40 -0800)
committerTim Otten <totten@civicrm.org>
Fri, 17 Feb 2023 06:51:13 +0000 (22:51 -0800)
commit1cc1711f3495ba33c2d3552e70bf5bd550cb64c2
treea55ed959c4bcab142f2eedd7dcf2fca9716681cc
parentc9d58b80f96e181649be266c54490e1b85617994
Disambiguate `Address.state_province_id:abbr` (MySQL; simpler version)

Consider `ContactJoinTest::testCreateWithPrimaryAndBilling` which writes the value:

  'address_billing.state_province_id:abbr' => 'AK',

The symbol 'AK' can map to three places: Akwa Ibom (Nigeria), Atakora
(Benin), and Alaska (USA).  This is an ambiguous choice.  It should be
resolved in a consistent way.

One flavor of ambiguity comes from MySQL.  When loading abbreviations, Civi
queries with `ORDER BY abbreviation`.  This is a *typically* stable, but it
has no *guaranteed* resolution.  Adding a secondary sort key makes the
outcome clear/unambiguous.
CRM/Core/PseudoConstant.php