From 823e7e14c3db6c89eac7509bde2fb19b22d9a233 Mon Sep 17 00:00:00 2001 From: Ian Kelling Date: Wed, 10 Nov 2021 21:05:07 -0500 Subject: [PATCH] province abbreviation patch - issue 724 --- CRM/Contact/BAO/Query.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/CRM/Contact/BAO/Query.php b/CRM/Contact/BAO/Query.php index 3200224475..446f12ddc2 100644 --- a/CRM/Contact/BAO/Query.php +++ b/CRM/Contact/BAO/Query.php @@ -6071,7 +6071,16 @@ AND displayRelType.is_active = 1 } } elseif ($value['pseudoField'] == 'state_province_abbreviation') { - $dao->$key = CRM_Core_PseudoConstant::stateProvinceAbbreviation($val); + // old bad code: +// $dao->$key = CRM_Core_PseudoConstant::stateProvinceAbbreviation($val); + // iank: Return abbreviation if its a province from a country that uses abbreviations, + // otherwise return the name of the province. + // https://lab.civicrm.org/dev/core/issues/724 + if (is_numeric(CRM_Core_PseudoConstant::stateProvinceAbbreviation($val))) { + $dao->$key = CRM_Core_PseudoConstant::stateProvince($val); + } else { + $dao->$key = CRM_Core_PseudoConstant::stateProvinceAbbreviation($val); + } } // @todo handle this in the section above for pseudoconstants. elseif (in_array($value['pseudoField'], ['participant_role_id', 'participant_role'])) { -- 2.25.1