From 7cd7503c67744f99c809a550d35f24d711b1b0bd Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Fri, 20 Jan 2023 10:51:51 -0500 Subject: [PATCH] CustomFields - Drop unused column 'mask' This column doesn't appear to be used for anything. --- CRM/Core/DAO/CustomField.php | 25 +------------------ CRM/Custom/Form/Field.php | 8 +++--- CRM/Upgrade/Incremental/php/FiveFiftyNine.php | 1 + xml/schema/Core/CustomField.xml | 1 + 4 files changed, 6 insertions(+), 29 deletions(-) diff --git a/CRM/Core/DAO/CustomField.php b/CRM/Core/DAO/CustomField.php index d971cd92ab3f..8faf7f472841 100644 --- a/CRM/Core/DAO/CustomField.php +++ b/CRM/Core/DAO/CustomField.php @@ -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 @@ public static function &fields() { '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, diff --git a/CRM/Custom/Form/Field.php b/CRM/Custom/Form/Field.php index 3a4db3b7e554..0ae4d84ce06f 100644 --- a/CRM/Custom/Form/Field.php +++ b/CRM/Custom/Form/Field.php @@ -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 @@ public function buildQuickForm() { $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 @@ public function buildQuickForm() { $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 @@ public static function formRule($fields, $files, $self) { } } 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.'); diff --git a/CRM/Upgrade/Incremental/php/FiveFiftyNine.php b/CRM/Upgrade/Incremental/php/FiveFiftyNine.php index b084959644c9..f0573ceecc16 100644 --- a/CRM/Upgrade/Incremental/php/FiveFiftyNine.php +++ b/CRM/Upgrade/Incremental/php/FiveFiftyNine.php @@ -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'); } } diff --git a/xml/schema/Core/CustomField.xml b/xml/schema/Core/CustomField.xml index 2afefa9b2536..f9fd912d76df 100644 --- a/xml/schema/Core/CustomField.xml +++ b/xml/schema/Core/CustomField.xml @@ -171,6 +171,7 @@ 64 Optional format instructions for specific field types, like date types. 1.1 + 5.59 attributes