Pseudoconstant - always explicitly name abbrColumn
authorColeman Watts <coleman@civicrm.org>
Wed, 18 Aug 2021 19:12:58 +0000 (15:12 -0400)
committerColeman Watts <coleman@civicrm.org>
Fri, 20 Aug 2021 15:24:31 +0000 (11:24 -0400)
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
CRM/Core/DAO/County.php
CRM/Core/PseudoConstant.php
xml/schema/Core/Address.xml
xml/schema/Core/County.xml

index 0ce4ef2710ab2b23008ed182ae3b2e031bdf5341..83f8f7891ffe1cf7cd3c461d68e0344b633cd989 100644 (file)
@@ -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',
         ],
index 943f2d724b3b20730669e10760df8af712247c9f..0ab0d03f0f260b8291d3309e57699e7062b64c42 100644 (file)
@@ -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',
         ],
index 9e84516231bea54030beb85657984e630c712d24..494201eaa68fd2f587ad0448e2ea8c5865ad1554 100644 (file)
@@ -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
index 9eb295ad22b581b4a65f8fbeef1b4c17e2695a2c..1ee08b9816cd55ba566e3242f7470ace134de4c9 100644 (file)
       <table>civicrm_county</table>
       <keyColumn>id</keyColumn>
       <labelColumn>name</labelColumn>
+      <abbrColumn>abbreviation</abbrColumn>
     </pseudoconstant>
     <html>
       <type>ChainSelect</type>
       <table>civicrm_state_province</table>
       <keyColumn>id</keyColumn>
       <labelColumn>name</labelColumn>
+      <abbrColumn>abbreviation</abbrColumn>
     </pseudoconstant>
     <localize_context>province</localize_context>
     <html>
index b679f62af904f8f8e026b8573793f5491357486e..47a28a22ad9d2dc9a22616c6907e25e2c8c61142 100644 (file)
@@ -54,6 +54,7 @@
       <table>civicrm_state_province</table>
       <keyColumn>id</keyColumn>
       <labelColumn>name</labelColumn>
+      <abbrColumn>abbreviation</abbrColumn>
     </pseudoconstant>
   </field>
   <foreignKey>