CustomFields - Drop unused column 'mask'
authorColeman Watts <coleman@civicrm.org>
Fri, 20 Jan 2023 15:51:51 +0000 (10:51 -0500)
committerColeman Watts <coleman@civicrm.org>
Fri, 20 Jan 2023 15:51:51 +0000 (10:51 -0500)
This column doesn't appear to be used for anything.

CRM/Core/DAO/CustomField.php
CRM/Custom/Form/Field.php
CRM/Upgrade/Incremental/php/FiveFiftyNine.php
xml/schema/Core/CustomField.xml

index d971cd92ab3fbdec5bfb04e028a9c5ef0ea2b470..8faf7f472841dae228fa23a920043d7c0130da7f 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/CustomField.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:b36f8202db0be873208f1895f3b3dc87)
+ * (GenCodeChecksum:f102cd2c666ba101ff0933c9fdac92ce)
  */
 
 /**
@@ -167,15 +167,6 @@ class CRM_Core_DAO_CustomField extends CRM_Core_DAO {
    */
   public $help_post;
 
-  /**
-   * Optional format instructions for specific field types, like date types.
-   *
-   * @var string|null
-   *   (SQL type: varchar(64))
-   *   Note that values will be retrieved from the database as a string.
-   */
-  public $mask;
-
   /**
    * Store collection of type-appropriate attributes, e.g. textarea  needs rows/cols attributes
    *
@@ -578,20 +569,6 @@ class CRM_Core_DAO_CustomField extends CRM_Core_DAO {
           'localizable' => 1,
           'add' => '1.1',
         ],
-        'mask' => [
-          'name' => 'mask',
-          'type' => CRM_Utils_Type::T_STRING,
-          'title' => ts('Custom Field Formatting'),
-          'description' => ts('Optional format instructions for specific field types, like date types.'),
-          'maxlength' => 64,
-          'size' => CRM_Utils_Type::BIG,
-          'where' => 'civicrm_custom_field.mask',
-          'table_name' => 'civicrm_custom_field',
-          'entity' => 'CustomField',
-          'bao' => 'CRM_Core_BAO_CustomField',
-          'localizable' => 0,
-          'add' => '1.1',
-        ],
         'attributes' => [
           'name' => 'attributes',
           'type' => CRM_Utils_Type::T_STRING,
index 3a4db3b7e55442941c985c26d498c09f65bc011f..0ae4d84ce06fe29459ae77fc50a90e340d1cd104 100644 (file)
@@ -70,6 +70,7 @@ class CRM_Custom_Form_Field extends CRM_Core_Form {
     'File' => ['File'],
     'Link' => ['Link'],
     'ContactReference' => ['Autocomplete-Select'],
+    'EntityReference' => ['Autocomplete-Select'],
   ];
 
   /**
@@ -417,7 +418,7 @@ class CRM_Custom_Form_Field extends CRM_Core_Form {
     $this->add('number', 'options_per_line', ts('Options Per Line'), ['min' => 0]);
     $this->addRule('options_per_line', ts('must be a numeric value'), 'numeric');
 
-    // default value, help pre, help post, mask, attributes, javascript ?
+    // default value, help pre, help post
     $this->add('text', 'default_value', ts('Default Value'),
       $attributes['default_value']
     );
@@ -427,9 +428,6 @@ class CRM_Custom_Form_Field extends CRM_Core_Form {
     $this->add('textarea', 'help_post', ts('Field Post Help'),
       $attributes['help_post']
     );
-    $this->add('text', 'mask', ts('Mask'),
-      $attributes['mask']
-    );
 
     // is active ?
     $this->add('advcheckbox', 'is_active', ts('Active?'));
@@ -740,7 +738,7 @@ SELECT count(*)
       }
     }
     elseif (in_array($htmlType, self::$htmlTypesWithOptions) &&
-      !in_array($dataType, ['Boolean', 'Country', 'StateProvince', 'ContactReference'])
+      !in_array($dataType, ['Boolean', 'Country', 'StateProvince', 'ContactReference', 'EntityReference'])
     ) {
       if (!$fields['option_group_id']) {
         $errors['option_group_id'] = ts('You must select a Multiple Choice Option set if you chose Reuse an existing set.');
index b084959644c998fcc184323adc39c28874bf2009..f0573ceecc161a3d2ed9ee6691b1a09050da62de 100644 (file)
@@ -29,6 +29,7 @@ class CRM_Upgrade_Incremental_php_FiveFiftyNine extends CRM_Upgrade_Incremental_
    */
   public function upgrade_5_59_alpha1($rev): void {
     $this->addTask(ts('Upgrade DB to %1: SQL', [1 => $rev]), 'runSql', $rev);
+    $this->addTask('Drop column civicrm_custom_field.mask', 'dropColumn', 'civicrm_custom_field', 'mask');
   }
 
 }
index 2afefa9b2536ce0b4e3b36f597c9ea0e1a11b1b6..f9fd912d76df47a6f16fe1a67cd30a8053d3e781 100644 (file)
     <length>64</length>
     <comment>Optional format instructions for specific field types, like date types.</comment>
     <add>1.1</add>
+    <drop>5.59</drop>
   </field>
   <field>
     <name>attributes</name>