From 70c5cd9721450911725d22a1e8173da6e9d48bc4 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Wed, 18 Aug 2021 15:12:58 -0400 Subject: [PATCH] Pseudoconstant - always explicitly name abbrColumn Stop the overly-clever guesswork of abbrColumn so that it can always be know if a pseudoconstant has an abbreviation. --- CRM/Core/DAO/Address.php | 4 +++- CRM/Core/DAO/County.php | 3 ++- CRM/Core/PseudoConstant.php | 4 ++-- xml/schema/Core/Address.xml | 2 ++ xml/schema/Core/County.xml | 1 + 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CRM/Core/DAO/Address.php b/CRM/Core/DAO/Address.php index 0ce4ef2710..83f8f7891f 100644 --- a/CRM/Core/DAO/Address.php +++ b/CRM/Core/DAO/Address.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/Address.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:bd0caca7da12cba4ed8161b892a77229) + * (GenCodeChecksum:40a96138e8081eaba0460889f49cc1cf) */ /** @@ -619,6 +619,7 @@ class CRM_Core_DAO_Address extends CRM_Core_DAO { 'table' => 'civicrm_county', 'keyColumn' => 'id', 'labelColumn' => 'name', + 'abbrColumn' => 'abbreviation', ], 'add' => '1.1', ], @@ -643,6 +644,7 @@ class CRM_Core_DAO_Address extends CRM_Core_DAO { 'table' => 'civicrm_state_province', 'keyColumn' => 'id', 'labelColumn' => 'name', + 'abbrColumn' => 'abbreviation', ], 'add' => '1.1', ], diff --git a/CRM/Core/DAO/County.php b/CRM/Core/DAO/County.php index 943f2d724b..0ab0d03f0f 100644 --- a/CRM/Core/DAO/County.php +++ b/CRM/Core/DAO/County.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/County.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:6666108a662d719144f390bf4746268d) + * (GenCodeChecksum:f54f7ff28a6ecde09252698c389db154) */ /** @@ -181,6 +181,7 @@ class CRM_Core_DAO_County extends CRM_Core_DAO { 'table' => 'civicrm_state_province', 'keyColumn' => 'id', 'labelColumn' => 'name', + 'abbrColumn' => 'abbreviation', ], 'add' => '1.1', ], diff --git a/CRM/Core/PseudoConstant.php b/CRM/Core/PseudoConstant.php index 9e84516231..494201eaa6 100644 --- a/CRM/Core/PseudoConstant.php +++ b/CRM/Core/PseudoConstant.php @@ -1513,8 +1513,8 @@ WHERE id = %1 } // Use abbrColum if context is abbreviate - if ($context === 'abbreviate' && (in_array('abbreviation', $availableFields) || !empty($pseudoconstant['abbrColumn']))) { - $params['labelColumn'] = $pseudoconstant['abbrColumn'] ?? 'abbreviation'; + if ($context === 'abbreviate' && !empty($pseudoconstant['abbrColumn'])) { + $params['labelColumn'] = $pseudoconstant['abbrColumn']; } // Condition param can be passed as an sql clause string or an array of clauses diff --git a/xml/schema/Core/Address.xml b/xml/schema/Core/Address.xml index 9eb295ad22..1ee08b9816 100644 --- a/xml/schema/Core/Address.xml +++ b/xml/schema/Core/Address.xml @@ -265,6 +265,7 @@ civicrm_county
id name + abbreviation ChainSelect @@ -292,6 +293,7 @@ civicrm_state_province
id name + abbreviation province diff --git a/xml/schema/Core/County.xml b/xml/schema/Core/County.xml index b679f62af9..47a28a22ad 100644 --- a/xml/schema/Core/County.xml +++ b/xml/schema/Core/County.xml @@ -54,6 +54,7 @@ civicrm_state_province
id name + abbreviation -- 2.25.1