From c9ae8a39ff03936a06c636d57230d2e433e279c1 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Thu, 31 Mar 2022 13:52:23 -0400 Subject: [PATCH] Add option_value_fields metadata This allows an optionGroup to declare which columns of the OptionValue table it uses. Previously this was hard-coded into the form. --- CRM/Admin/Form/Options.php | 11 +- CRM/Core/DAO/OptionGroup.php | 36 +++- CRM/Core/SelectValues.php | 17 ++ CRM/Upgrade/Incremental/php/FiveFortyNine.php | 25 +++ Civi/Api4/Service/Spec/FieldSpec.php | 2 +- .../Spec/Provider/ContactGetSpecProvider.php | 2 +- .../Provider/EntityTagFilterSpecProvider.php | 2 +- Civi/Api4/Service/Spec/SpecFormatter.php | 34 +++- tests/phpunit/api/v4/Action/GetFieldsTest.php | 10 ++ xml/schema/Core/OptionGroup.xml | 17 +- xml/templates/civicrm_data.tpl | 168 +++++++++--------- 11 files changed, 223 insertions(+), 101 deletions(-) diff --git a/CRM/Admin/Form/Options.php b/CRM/Admin/Form/Options.php index b5002a575e..4de1b42040 100644 --- a/CRM/Admin/Form/Options.php +++ b/CRM/Admin/Form/Options.php @@ -147,6 +147,10 @@ class CRM_Admin_Form_Options extends CRM_Admin_Form { return; } + $optionGroup = \Civi\Api4\OptionGroup::get(FALSE) + ->addWhere('id', '=', $this->_gid) + ->execute()->first(); + $this->applyFilter('__ALL__', 'trim'); $isReserved = FALSE; @@ -174,11 +178,12 @@ class CRM_Admin_Form_Options extends CRM_Admin_Form { ['CRM_Core_DAO_OptionValue', $this->_id, $this->_gid, 'value', $this->_domainSpecific] ); } - else { + + // Add icon & color if this option group supports it. + if ($optionGroup['option_value_fields'] && in_array('icon', $optionGroup['option_value_fields'])) { $this->add('text', 'icon', ts('Icon'), ['class' => 'crm-icon-picker', 'title' => ts('Choose Icon'), 'allowClear' => TRUE]); } - - if (in_array($this->_gName, ['activity_status', 'case_status'])) { + if ($optionGroup['option_value_fields'] && in_array('color', $optionGroup['option_value_fields'])) { $this->add('color', 'color', ts('Color')); } diff --git a/CRM/Core/DAO/OptionGroup.php b/CRM/Core/DAO/OptionGroup.php index 77f9c5eed8..5c25768fd7 100644 --- a/CRM/Core/DAO/OptionGroup.php +++ b/CRM/Core/DAO/OptionGroup.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/OptionGroup.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:904ff47234843ffba9dd98b11c1d0df1) + * (GenCodeChecksum:c9bc7ac897d9d7ef0bc421f6e58bdf27) */ /** @@ -67,7 +67,7 @@ class CRM_Core_DAO_OptionGroup extends CRM_Core_DAO { public $description; /** - * Option group description. + * Type of data stored by this option group. * * @var string|null * (SQL type: varchar(128)) @@ -102,6 +102,15 @@ class CRM_Core_DAO_OptionGroup extends CRM_Core_DAO { */ public $is_locked; + /** + * Which optional columns from the option_value table are in use by this group. + * + * @var string|null + * (SQL type: varchar(128)) + * Note that values will be retrieved from the database as a string. + */ + public $option_value_fields; + /** * Class constructor. */ @@ -191,8 +200,8 @@ class CRM_Core_DAO_OptionGroup extends CRM_Core_DAO { 'data_type' => [ 'name' => 'data_type', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Data Type for this option group'), - 'description' => ts('Option group description.'), + 'title' => ts('Data Type'), + 'description' => ts('Type of data stored by this option group.'), 'maxlength' => 128, 'size' => CRM_Utils_Type::HUGE, 'where' => 'civicrm_option_group.data_type', @@ -247,6 +256,25 @@ class CRM_Core_DAO_OptionGroup extends CRM_Core_DAO { 'localizable' => 0, 'add' => '4.5', ], + 'option_value_fields' => [ + 'name' => 'option_value_fields', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Option Value Fields'), + 'description' => ts('Which optional columns from the option_value table are in use by this group.'), + 'maxlength' => 128, + 'size' => CRM_Utils_Type::HUGE, + 'where' => 'civicrm_option_group.option_value_fields', + 'default' => 'name,label,description', + 'table_name' => 'civicrm_option_group', + 'entity' => 'OptionGroup', + 'bao' => 'CRM_Core_BAO_OptionGroup', + 'localizable' => 0, + 'serialize' => self::SERIALIZE_COMMA, + 'pseudoconstant' => [ + 'callback' => 'CRM_Core_SelectValues::optionValueFields', + ], + 'add' => '5.49', + ], ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } diff --git a/CRM/Core/SelectValues.php b/CRM/Core/SelectValues.php index a6991c0834..6f309fedd5 100644 --- a/CRM/Core/SelectValues.php +++ b/CRM/Core/SelectValues.php @@ -1176,4 +1176,21 @@ class CRM_Core_SelectValues { ]; } + /** + * Columns from the option_value table which may or may not be used by each option_group. + * + * Note: Value is not listed here as it is not optional. + * + * @return string[] + */ + public static function optionValueFields() { + return [ + 'name' => 'name', + 'label' => 'label', + 'description' => 'description', + 'icon' => 'icon', + 'color' => 'color', + ]; + } + } diff --git a/CRM/Upgrade/Incremental/php/FiveFortyNine.php b/CRM/Upgrade/Incremental/php/FiveFortyNine.php index 269073cea2..5b81a5496e 100644 --- a/CRM/Upgrade/Incremental/php/FiveFortyNine.php +++ b/CRM/Upgrade/Incremental/php/FiveFortyNine.php @@ -67,6 +67,9 @@ class CRM_Upgrade_Incremental_php_FiveFortyNine extends CRM_Upgrade_Incremental_ $this->addTask("Update $tableName.$columnName to be NOT NULL", 'changeBooleanColumn', $tableName, $columnName, $defn); } } + $this->addTask('Add civicrm_option_group.option_value_fields column', 'addColumn', + 'civicrm_option_group', 'option_value_fields', "varchar(128) DEFAULT \"name,label,description\" COMMENT 'Which optional columns from the option_value table are in use by this group.'"); + $this->addTask('Populate civicrm_option_group.option_value_fields column', 'fillOptionValueFields'); } /** @@ -82,4 +85,26 @@ class CRM_Upgrade_Incremental_php_FiveFortyNine extends CRM_Upgrade_Incremental_ return TRUE; } + public static function fillOptionValueFields(CRM_Queue_TaskContext $ctx) { + // By default every option group uses 'name,description' + // Note: description doesn't make sense for every group, but historically Civi has been lax + // about restricting its use. + CRM_Core_DAO::executeQuery("UPDATE `civicrm_option_group` SET `option_value_fields` = 'name,label,description'", [], TRUE, NULL, FALSE, FALSE); + + $groupsWithDifferentFields = [ + 'name,label,description,color' => [ + 'activity_status', + 'case_status', + ], + 'name,label,description,icon' => [ + 'activity_type', + ], + ]; + foreach ($groupsWithDifferentFields as $fields => $names) { + $in = '"' . implode('","', $names) . '"'; + CRM_Core_DAO::executeQuery("UPDATE `civicrm_option_group` SET `option_value_fields` = '$fields' WHERE `name` IN ($in)", [], TRUE, NULL, FALSE, FALSE); + } + return TRUE; + } + } diff --git a/Civi/Api4/Service/Spec/FieldSpec.php b/Civi/Api4/Service/Spec/FieldSpec.php index 89f1386416..58b1c526da 100644 --- a/Civi/Api4/Service/Spec/FieldSpec.php +++ b/Civi/Api4/Service/Spec/FieldSpec.php @@ -23,7 +23,7 @@ class FieldSpec { // DataTypeSpecTrait: dataType, serialize, fkEntity use \Civi\Schema\Traits\DataTypeSpecTrait; - // OptionsSpecTrait: options, optionsCallback + // OptionsSpecTrait: options, optionsCallback, suffixes use \Civi\Schema\Traits\OptionsSpecTrait; // GuiSpecTrait: label, inputType, inputAttrs, helpPre, helpPost diff --git a/Civi/Api4/Service/Spec/Provider/ContactGetSpecProvider.php b/Civi/Api4/Service/Spec/Provider/ContactGetSpecProvider.php index 632dcd3cc1..75de36c5ff 100644 --- a/Civi/Api4/Service/Spec/Provider/ContactGetSpecProvider.php +++ b/Civi/Api4/Service/Spec/Provider/ContactGetSpecProvider.php @@ -31,7 +31,7 @@ class ContactGetSpecProvider implements Generic\SpecProviderInterface { ->setType('Filter') ->setOperators(['IN', 'NOT IN']) ->addSqlFilter([__CLASS__, 'getContactGroupSql']) - ->setSuffixes(['id', 'name', 'label']) + ->setSuffixes(['name', 'label']) ->setOptionsCallback([__CLASS__, 'getGroupList']); $spec->addFieldSpec($field); diff --git a/Civi/Api4/Service/Spec/Provider/EntityTagFilterSpecProvider.php b/Civi/Api4/Service/Spec/Provider/EntityTagFilterSpecProvider.php index be1aad01e7..df3f51f4ac 100644 --- a/Civi/Api4/Service/Spec/Provider/EntityTagFilterSpecProvider.php +++ b/Civi/Api4/Service/Spec/Provider/EntityTagFilterSpecProvider.php @@ -33,7 +33,7 @@ class EntityTagFilterSpecProvider implements Generic\SpecProviderInterface { ->setType('Filter') ->setOperators(['IN', 'NOT IN']) ->addSqlFilter([__CLASS__, 'getTagFilterSql']) - ->setSuffixes(['id', 'name', 'label', 'description', 'color']) + ->setSuffixes(['name', 'label', 'description', 'color']) ->setOptionsCallback([__CLASS__, 'getTagList']); $spec->addFieldSpec($field); } diff --git a/Civi/Api4/Service/Spec/SpecFormatter.php b/Civi/Api4/Service/Spec/SpecFormatter.php index 058f83dea2..54b1019090 100644 --- a/Civi/Api4/Service/Spec/SpecFormatter.php +++ b/Civi/Api4/Service/Spec/SpecFormatter.php @@ -13,6 +13,7 @@ namespace Civi\Api4\Service\Spec; use Civi\Api4\Utils\CoreUtil; +use Civi\Api4\Utils\FormattingUtil; use CRM_Core_DAO_AllCoreTables as AllCoreTables; class SpecFormatter { @@ -46,11 +47,11 @@ class SpecFormatter { $field->setHelpPost($data['help_post'] ?? NULL); if (self::customFieldHasOptions($data)) { $field->setOptionsCallback([__CLASS__, 'getOptions']); + $suffixes = ['label']; if (!empty($data['option_group_id'])) { - // Option groups support other stuff like description, icon & color, - // but at time of this writing, custom fields do not. - $field->setSuffixes(['id', 'name', 'label']); + $suffixes = self::getOptionValueFields($data['option_group_id'], 'id'); } + $field->setSuffixes($suffixes); } $field->setReadonly($data['is_view']); } @@ -71,11 +72,14 @@ class SpecFormatter { // These suffixes are always supported if a field has options $suffixes = ['name', 'label']; // Add other columns specified in schema (e.g. 'abbrColumn') - foreach (['description', 'abbr', 'icon', 'color'] as $suffix) { - if (isset($data['pseudoconstant'][$suffix . 'Column'])) { + foreach (array_diff(FormattingUtil::$pseudoConstantSuffixes, $suffixes) as $suffix) { + if (!empty($data['pseudoconstant'][$suffix . 'Column'])) { $suffixes[] = $suffix; } } + if (!empty($data['pseudoconstant']['optionGroupName'])) { + $suffixes = self::getOptionValueFields($data['pseudoconstant']['optionGroupName'], 'name'); + } $field->setSuffixes($suffixes); } $field->setReadonly(!empty($data['readonly'])); @@ -95,6 +99,26 @@ class SpecFormatter { return $field; } + /** + * Get the suffixes supported by this option group + * + * @param string|int $optionGroup + * OptionGroup id or name + * @param string $key + * Is $optionGroup being passed as "id" or "name" + * @return array + */ + private static function getOptionValueFields($optionGroup, $key) { + // Prevent crash during upgrade + if (array_key_exists('option_value_fields', \CRM_Core_DAO_OptionGroup::getSupportedFields())) { + $fields = \CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', $optionGroup, 'option_value_fields', $key); + } + if (!isset($fields)) { + return ['name', 'label', 'description']; + } + return explode(',', $fields); + } + /** * Does this custom field have options * diff --git a/tests/phpunit/api/v4/Action/GetFieldsTest.php b/tests/phpunit/api/v4/Action/GetFieldsTest.php index e58f066520..b6646e5e22 100644 --- a/tests/phpunit/api/v4/Action/GetFieldsTest.php +++ b/tests/phpunit/api/v4/Action/GetFieldsTest.php @@ -105,4 +105,14 @@ class GetFieldsTest extends UnitTestCase { $this->assertTrue($actFields['subject']['nullable']); } + public function testGetSuffixes() { + $actFields = Activity::getFields(FALSE) + ->execute()->indexBy('name'); + + $this->assertEquals(['name', 'label', 'description'], $actFields['engagement_level']['suffixes']); + $this->assertEquals(['name', 'label', 'description', 'icon'], $actFields['activity_type_id']['suffixes']); + $this->assertEquals(['name', 'label', 'description', 'color'], $actFields['status_id']['suffixes']); + $this->assertEquals(['name', 'label', 'description', 'color'], $actFields['tags']['suffixes']); + } + } diff --git a/xml/schema/Core/OptionGroup.xml b/xml/schema/Core/OptionGroup.xml index 018922c6ae..36c6407642 100644 --- a/xml/schema/Core/OptionGroup.xml +++ b/xml/schema/Core/OptionGroup.xml @@ -50,10 +50,10 @@ data_type - Data Type for this option group + Data Type varchar 128 - Option group description. + Type of data stored by this option group. CRM_Utils_Type::dataTypes @@ -86,6 +86,19 @@ A lock to remove the ability to add new options via the UI. 4.5 + + option_value_fields + Option Value Fields + varchar + 128 + "name,label,description" + Which optional columns from the option_value table are in use by this group. + + CRM_Core_SelectValues::optionValueFields + + COMMA + 5.49 + UI_name name diff --git a/xml/templates/civicrm_data.tpl b/xml/templates/civicrm_data.tpl index 12349708e6..005267b486 100644 --- a/xml/templates/civicrm_data.tpl +++ b/xml/templates/civicrm_data.tpl @@ -119,91 +119,91 @@ VALUES -- option groups and values for 'preferred communication methods' , 'activity types', 'gender', etc. INSERT INTO - `civicrm_option_group` (`name`, `title`, `data_type`, `is_reserved`, `is_active`, `is_locked`) + `civicrm_option_group` (`name`, `title`, `data_type`, `is_reserved`, `is_active`, `is_locked`, `option_value_fields`) VALUES - ('preferred_communication_method', '{ts escape="sql"}Preferred Communication Method{/ts}' , NULL, 1, 1, 0), - ('activity_type' , '{ts escape="sql"}Activity Type{/ts}' , 'Integer', 1, 1, 0), - ('gender' , '{ts escape="sql"}Gender{/ts}' , 'Integer', 1, 1, 0), - ('instant_messenger_service' , '{ts escape="sql"}Instant Messenger (IM) screen-names{/ts}', NULL, 1, 1, 0), - ('mobile_provider' , '{ts escape="sql"}Mobile Phone Providers{/ts}' , NULL, 1, 1, 0), - ('individual_prefix' , '{ts escape="sql"}Individual contact prefixes{/ts}' , NULL, 1, 1, 0), - ('individual_suffix' , '{ts escape="sql"}Individual contact suffixes{/ts}' , NULL, 1, 1, 0), - ('acl_role' , '{ts escape="sql"}ACL Role{/ts}' , NULL, 1, 1, 0), - ('accept_creditcard' , '{ts escape="sql"}Accepted Credit Cards{/ts}' , NULL, 1, 1, 0), - ('payment_instrument' , '{ts escape="sql"}Payment Methods{/ts}' , 'Integer', 1, 1, 0), - ('contribution_status' , '{ts escape="sql"}Contribution Status{/ts}' , NULL, 1, 1, 1), - ('pcp_status' , '{ts escape="sql"}PCP Status{/ts}' , NULL, 1, 1, 1), - ('pcp_owner_notify' , '{ts escape="sql"}PCP owner notifications{/ts}' , NULL, 1, 1, 1), - ('participant_role' , '{ts escape="sql"}Participant Role{/ts}' , 'Integer', 1, 1, 0), - ('event_type' , '{ts escape="sql"}Event Type{/ts}' , 'Integer', 1, 1, 0), - ('contact_view_options' , '{ts escape="sql"}Contact View Options{/ts}' , NULL, 1, 1, 1), - ('contact_smart_group_display' , '{ts escape="sql"}Contact Smart Group View Options{/ts}' , NULL, 1, 1, 1), - ('contact_edit_options' , '{ts escape="sql"}Contact Edit Options{/ts}' , NULL, 1, 1, 1), - ('advanced_search_options' , '{ts escape="sql"}Advanced Search Options{/ts}' , NULL, 1, 1, 1), - ('user_dashboard_options' , '{ts escape="sql"}User Dashboard Options{/ts}' , NULL, 1, 1, 1), - ('address_options' , '{ts escape="sql"}Addressing Options{/ts}' , NULL, 1, 1, 0), - ('group_type' , '{ts escape="sql"}Group Type{/ts}' , NULL, 1, 1, 0), - ('custom_search' , '{ts escape="sql"}Custom Search{/ts}' , NULL, 1, 1, 0), - ('activity_status' , '{ts escape="sql"}Activity Status{/ts}' , 'Integer', 1, 1, 0), - ('case_type' , '{ts escape="sql"}Case Type{/ts}' , NULL, 1, 1, 0), - ('case_status' , '{ts escape="sql"}Case Status{/ts}' , NULL, 1, 1, 0), - ('participant_listing' , '{ts escape="sql"}Participant Listing{/ts}' , NULL, 1, 1, 0), - ('safe_file_extension' , '{ts escape="sql"}Safe File Extension{/ts}' , NULL, 1, 1, 0), - ('from_email_address' , '{ts escape="sql"}From Email Address{/ts}' , NULL, 1, 1, 0), - ('mapping_type' , '{ts escape="sql"}Mapping Type{/ts}' , NULL, 1, 1, 1), - ('wysiwyg_editor' , '{ts escape="sql"}WYSIWYG Editor{/ts}' , NULL, 1, 1, 0), - ('recur_frequency_units' , '{ts escape="sql"}Recurring Frequency Units{/ts}' , NULL, 1, 1, 0), - ('phone_type' , '{ts escape="sql"}Phone Type{/ts}' , NULL, 1, 1, 0), - ('custom_data_type' , '{ts escape="sql"}Custom Data Type{/ts}' , NULL, 1, 1, 0), - ('visibility' , '{ts escape="sql"}Visibility{/ts}' , NULL, 1, 1, 0), - ('mail_protocol' , '{ts escape="sql"}Mail Protocol{/ts}' , NULL, 1, 1, 0), - ('priority' , '{ts escape="sql"}Priority{/ts}' , NULL, 1, 1, 0), - ('redaction_rule' , '{ts escape="sql"}Redaction Rule{/ts}' , NULL, 1, 1, 0), - ('report_template' , '{ts escape="sql"}Report Template{/ts}' , NULL, 1, 1, 0), - ('email_greeting' , '{ts escape="sql"}Email Greeting Type{/ts}' , NULL, 1, 1, 0), - ('postal_greeting' , '{ts escape="sql"}Postal Greeting Type{/ts}' , NULL, 1, 1, 0), - ('addressee' , '{ts escape="sql"}Addressee Type{/ts}' , NULL, 1, 1, 0), - ('contact_autocomplete_options' , '{ts escape="sql"}Autocomplete Contact Search{/ts}' , NULL, 1, 1, 1), - ('contact_reference_options' , '{ts escape="sql"}Contact Reference Autocomplete Options{/ts}', NULL, 1, 1, 1), - ('website_type' , '{ts escape="sql"}Website Type{/ts}' , NULL, 1, 1, 0), - ('tag_used_for' , '{ts escape="sql"}Tag Used For{/ts}' , NULL, 1, 1, 1), - ('note_used_for' , '{ts escape="sql"}Note Used For{/ts}' , NULL, 1, 1, 1), - ('currencies_enabled' , '{ts escape="sql"}Currencies Enabled{/ts}' , NULL, 1, 1, 0), - ('event_badge' , '{ts escape="sql"}Event Name Badge{/ts}' , NULL, 1, 1, 0), - ('note_privacy' , '{ts escape="sql"}Privacy levels for notes{/ts}' , NULL, 1, 1, 0), - ('campaign_type' , '{ts escape="sql"}Campaign Type{/ts}' , NULL, 1, 1, 0), - ('campaign_status' , '{ts escape="sql"}Campaign Status{/ts}' , NULL, 1, 1, 0), - ('system_extensions' , '{ts escape="sql"}CiviCRM Extensions{/ts}' , NULL, 1, 1, 0), - ('mail_approval_status' , '{ts escape="sql"}CiviMail Approval Status{/ts}' , NULL, 1, 1, 0), - ('engagement_index' , '{ts escape="sql"}Engagement Index{/ts}' , NULL, 1, 1, 0), - ('cg_extend_objects' , '{ts escape="sql"}Objects a custom group extends to{/ts}' , NULL, 1, 1, 0), - ('paper_size' , '{ts escape="sql"}Paper Size{/ts}' , NULL, 1, 1, 0), - ('pdf_format' , '{ts escape="sql"}PDF Page Format{/ts}' , NULL, 1, 1, 0), - ('label_format' , '{ts escape="sql"}Mailing Label Format{/ts}' , NULL, 1, 1, 0), - ('activity_contacts' , '{ts escape="sql"}Activity Contacts{/ts}' , NULL, 1, 1, 1), - ('account_relationship' , '{ts escape="sql"}Account Relationship{/ts}' , NULL, 1, 1, 0), - ('event_contacts' , '{ts escape="sql"}Event Recipients{/ts}' , NULL, 1, 1, 0), - ('conference_slot' , '{ts escape="sql"}Conference Slot{/ts}' , NULL, 1, 1, 0), - ('batch_type' , '{ts escape="sql"}Batch Type{/ts}' , NULL, 1, 1, 1), - ('batch_mode' , '{ts escape="sql"}Batch Mode{/ts}' , NULL, 1, 1, 1), - ('batch_status' , '{ts escape="sql"}Batch Status{/ts}' , NULL, 1, 1, 1), - ('sms_api_type' , '{ts escape="sql"}Api Type{/ts}' , NULL, 1, 1, 0), - ('sms_provider_name' , '{ts escape="sql"}Sms Provider Internal Name{/ts}' , NULL, 1, 1, 0), - ('auto_renew_options' , '{ts escape="sql"}Auto Renew Options{/ts}' , NULL, 1, 1, 1), - ('financial_account_type' , '{ts escape="sql"}Financial Account Type{/ts}' , NULL, 1, 1, 0), - ('financial_item_status' , '{ts escape="sql"}Financial Item Status{/ts}' , NULL, 1, 1, 1), - ('label_type' , '{ts escape="sql"}Label Type{/ts}' , NULL, 1, 1, 0), - ('name_badge' , '{ts escape="sql"}Name Badge Format{/ts}' , NULL, 1, 1, 0), - ('communication_style' , '{ts escape="sql"}Communication Style{/ts}' , NULL, 1, 1, 0), - ('msg_mode' , '{ts escape="sql"}Message Mode{/ts}' , NULL, 1, 1, 0), - ('contact_date_reminder_options' , '{ts escape="sql"}Contact Date Reminder Options{/ts}' , NULL, 1, 1, 1), - ('wysiwyg_presets' , '{ts escape="sql"}WYSIWYG Editor Presets{/ts}' , NULL, 1, 1, 0), - ('relative_date_filters' , '{ts escape="sql"}Relative Date Filters{/ts}' , NULL, 1, 1, 0), - ('pledge_status' , '{ts escape="sql"}Pledge Status{/ts}' , NULL, 1, 1, 1), - ('contribution_recur_status' , '{ts escape="sql"}Recurring Contribution Status{/ts}' , NULL, 1, 1, 1), - ('environment' , '{ts escape="sql"}Environment{/ts}' , NULL, 1, 1, 0), - ('activity_default_assignee' , '{ts escape="sql"}Activity default assignee{/ts}' , NULL, 1, 1, 0), - ('entity_batch_extends' , '{ts escape="sql"}Entity Batch Extends{/ts}' , NULL, 1, 1, 0); + ('preferred_communication_method', '{ts escape="sql"}Preferred Communication Method{/ts}' , NULL, 1, 1, 0, 'name,label,description'), + ('activity_type' , '{ts escape="sql"}Activity Type{/ts}' , 'Integer', 1, 1, 0, 'name,label,description,icon'), + ('gender' , '{ts escape="sql"}Gender{/ts}' , 'Integer', 1, 1, 0, 'name,label,description'), + ('instant_messenger_service' , '{ts escape="sql"}Instant Messenger (IM) screen-names{/ts}', NULL, 1, 1, 0, 'name,label,description'), + ('mobile_provider' , '{ts escape="sql"}Mobile Phone Providers{/ts}' , NULL, 1, 1, 0, 'name,label,description'), + ('individual_prefix' , '{ts escape="sql"}Individual contact prefixes{/ts}' , NULL, 1, 1, 0, 'name,label,description'), + ('individual_suffix' , '{ts escape="sql"}Individual contact suffixes{/ts}' , NULL, 1, 1, 0, 'name,label,description'), + ('acl_role' , '{ts escape="sql"}ACL Role{/ts}' , NULL, 1, 1, 0, 'name,label,description'), + ('accept_creditcard' , '{ts escape="sql"}Accepted Credit Cards{/ts}' , NULL, 1, 1, 0, 'name,label,description'), + ('payment_instrument' , '{ts escape="sql"}Payment Methods{/ts}' , 'Integer', 1, 1, 0, 'name,label,description'), + ('contribution_status' , '{ts escape="sql"}Contribution Status{/ts}' , NULL, 1, 1, 1, 'name,label,description'), + ('pcp_status' , '{ts escape="sql"}PCP Status{/ts}' , NULL, 1, 1, 1, 'name,label,description'), + ('pcp_owner_notify' , '{ts escape="sql"}PCP owner notifications{/ts}' , NULL, 1, 1, 1, 'name,label,description'), + ('participant_role' , '{ts escape="sql"}Participant Role{/ts}' , 'Integer', 1, 1, 0, 'name,label,description'), + ('event_type' , '{ts escape="sql"}Event Type{/ts}' , 'Integer', 1, 1, 0, 'name,label,description'), + ('contact_view_options' , '{ts escape="sql"}Contact View Options{/ts}' , NULL, 1, 1, 1, 'name,label,description'), + ('contact_smart_group_display' , '{ts escape="sql"}Contact Smart Group View Options{/ts}' , NULL, 1, 1, 1, 'name,label,description'), + ('contact_edit_options' , '{ts escape="sql"}Contact Edit Options{/ts}' , NULL, 1, 1, 1, 'name,label,description'), + ('advanced_search_options' , '{ts escape="sql"}Advanced Search Options{/ts}' , NULL, 1, 1, 1, 'name,label,description'), + ('user_dashboard_options' , '{ts escape="sql"}User Dashboard Options{/ts}' , NULL, 1, 1, 1, 'name,label,description'), + ('address_options' , '{ts escape="sql"}Addressing Options{/ts}' , NULL, 1, 1, 0, 'name,label,description'), + ('group_type' , '{ts escape="sql"}Group Type{/ts}' , NULL, 1, 1, 0, 'name,label,description'), + ('custom_search' , '{ts escape="sql"}Custom Search{/ts}' , NULL, 1, 1, 0, 'name,label,description'), + ('activity_status' , '{ts escape="sql"}Activity Status{/ts}' , 'Integer', 1, 1, 0, 'name,label,description,color'), + ('case_type' , '{ts escape="sql"}Case Type{/ts}' , NULL, 1, 1, 0, 'name,label,description'), + ('case_status' , '{ts escape="sql"}Case Status{/ts}' , NULL, 1, 1, 0, 'name,label,description,color'), + ('participant_listing' , '{ts escape="sql"}Participant Listing{/ts}' , NULL, 1, 1, 0, 'name,label,description'), + ('safe_file_extension' , '{ts escape="sql"}Safe File Extension{/ts}' , NULL, 1, 1, 0, 'name,label,description'), + ('from_email_address' , '{ts escape="sql"}From Email Address{/ts}' , NULL, 1, 1, 0, 'name,label,description'), + ('mapping_type' , '{ts escape="sql"}Mapping Type{/ts}' , NULL, 1, 1, 1, 'name,label,description'), + ('wysiwyg_editor' , '{ts escape="sql"}WYSIWYG Editor{/ts}' , NULL, 1, 1, 0, 'name,label,description'), + ('recur_frequency_units' , '{ts escape="sql"}Recurring Frequency Units{/ts}' , NULL, 1, 1, 0, 'name,label,description'), + ('phone_type' , '{ts escape="sql"}Phone Type{/ts}' , NULL, 1, 1, 0, 'name,label,description'), + ('custom_data_type' , '{ts escape="sql"}Custom Data Type{/ts}' , NULL, 1, 1, 0, 'name,label,description'), + ('visibility' , '{ts escape="sql"}Visibility{/ts}' , NULL, 1, 1, 0, 'name,label,description'), + ('mail_protocol' , '{ts escape="sql"}Mail Protocol{/ts}' , NULL, 1, 1, 0, 'name,label,description'), + ('priority' , '{ts escape="sql"}Priority{/ts}' , NULL, 1, 1, 0, 'name,label,description'), + ('redaction_rule' , '{ts escape="sql"}Redaction Rule{/ts}' , NULL, 1, 1, 0, 'name,label,description'), + ('report_template' , '{ts escape="sql"}Report Template{/ts}' , NULL, 1, 1, 0, 'name,label,description'), + ('email_greeting' , '{ts escape="sql"}Email Greeting Type{/ts}' , NULL, 1, 1, 0, 'name,label,description'), + ('postal_greeting' , '{ts escape="sql"}Postal Greeting Type{/ts}' , NULL, 1, 1, 0, 'name,label,description'), + ('addressee' , '{ts escape="sql"}Addressee Type{/ts}' , NULL, 1, 1, 0, 'name,label,description'), + ('contact_autocomplete_options' , '{ts escape="sql"}Autocomplete Contact Search{/ts}' , NULL, 1, 1, 1, 'name,label,description'), + ('contact_reference_options' , '{ts escape="sql"}Contact Reference Autocomplete Options{/ts}', NULL, 1, 1, 1, 'name,label,description'), + ('website_type' , '{ts escape="sql"}Website Type{/ts}' , NULL, 1, 1, 0, 'name,label,description'), + ('tag_used_for' , '{ts escape="sql"}Tag Used For{/ts}' , NULL, 1, 1, 1, 'name,label,description'), + ('note_used_for' , '{ts escape="sql"}Note Used For{/ts}' , NULL, 1, 1, 1, 'name,label,description'), + ('currencies_enabled' , '{ts escape="sql"}Currencies Enabled{/ts}' , NULL, 1, 1, 0, 'name,label,description'), + ('event_badge' , '{ts escape="sql"}Event Name Badge{/ts}' , NULL, 1, 1, 0, 'name,label,description'), + ('note_privacy' , '{ts escape="sql"}Privacy levels for notes{/ts}' , NULL, 1, 1, 0, 'name,label,description'), + ('campaign_type' , '{ts escape="sql"}Campaign Type{/ts}' , NULL, 1, 1, 0, 'name,label,description'), + ('campaign_status' , '{ts escape="sql"}Campaign Status{/ts}' , NULL, 1, 1, 0, 'name,label,description'), + ('system_extensions' , '{ts escape="sql"}CiviCRM Extensions{/ts}' , NULL, 1, 1, 0, 'name,label,description'), + ('mail_approval_status' , '{ts escape="sql"}CiviMail Approval Status{/ts}' , NULL, 1, 1, 0, 'name,label,description'), + ('engagement_index' , '{ts escape="sql"}Engagement Index{/ts}' , NULL, 1, 1, 0, 'name,label,description'), + ('cg_extend_objects' , '{ts escape="sql"}Objects a custom group extends to{/ts}' , NULL, 1, 1, 0, 'name,label,description'), + ('paper_size' , '{ts escape="sql"}Paper Size{/ts}' , NULL, 1, 1, 0, 'name,label,description'), + ('pdf_format' , '{ts escape="sql"}PDF Page Format{/ts}' , NULL, 1, 1, 0, 'name,label,description'), + ('label_format' , '{ts escape="sql"}Mailing Label Format{/ts}' , NULL, 1, 1, 0, 'name,label,description'), + ('activity_contacts' , '{ts escape="sql"}Activity Contacts{/ts}' , NULL, 1, 1, 1, 'name,label,description'), + ('account_relationship' , '{ts escape="sql"}Account Relationship{/ts}' , NULL, 1, 1, 0, 'name,label,description'), + ('event_contacts' , '{ts escape="sql"}Event Recipients{/ts}' , NULL, 1, 1, 0, 'name,label,description'), + ('conference_slot' , '{ts escape="sql"}Conference Slot{/ts}' , NULL, 1, 1, 0, 'name,label,description'), + ('batch_type' , '{ts escape="sql"}Batch Type{/ts}' , NULL, 1, 1, 1, 'name,label,description'), + ('batch_mode' , '{ts escape="sql"}Batch Mode{/ts}' , NULL, 1, 1, 1, 'name,label,description'), + ('batch_status' , '{ts escape="sql"}Batch Status{/ts}' , NULL, 1, 1, 1, 'name,label,description'), + ('sms_api_type' , '{ts escape="sql"}Api Type{/ts}' , NULL, 1, 1, 0, 'name,label,description'), + ('sms_provider_name' , '{ts escape="sql"}Sms Provider Internal Name{/ts}' , NULL, 1, 1, 0, 'name,label,description'), + ('auto_renew_options' , '{ts escape="sql"}Auto Renew Options{/ts}' , NULL, 1, 1, 1, 'name,label,description'), + ('financial_account_type' , '{ts escape="sql"}Financial Account Type{/ts}' , NULL, 1, 1, 0, 'name,label,description'), + ('financial_item_status' , '{ts escape="sql"}Financial Item Status{/ts}' , NULL, 1, 1, 1, 'name,label,description'), + ('label_type' , '{ts escape="sql"}Label Type{/ts}' , NULL, 1, 1, 0, 'name,label,description'), + ('name_badge' , '{ts escape="sql"}Name Badge Format{/ts}' , NULL, 1, 1, 0, 'name,label,description'), + ('communication_style' , '{ts escape="sql"}Communication Style{/ts}' , NULL, 1, 1, 0, 'name,label,description'), + ('msg_mode' , '{ts escape="sql"}Message Mode{/ts}' , NULL, 1, 1, 0, 'name,label,description'), + ('contact_date_reminder_options' , '{ts escape="sql"}Contact Date Reminder Options{/ts}' , NULL, 1, 1, 1, 'name,label,description'), + ('wysiwyg_presets' , '{ts escape="sql"}WYSIWYG Editor Presets{/ts}' , NULL, 1, 1, 0, 'name,label,description'), + ('relative_date_filters' , '{ts escape="sql"}Relative Date Filters{/ts}' , NULL, 1, 1, 0, 'name,label,description'), + ('pledge_status' , '{ts escape="sql"}Pledge Status{/ts}' , NULL, 1, 1, 1, 'name,label,description'), + ('contribution_recur_status' , '{ts escape="sql"}Recurring Contribution Status{/ts}' , NULL, 1, 1, 1, 'name,label,description'), + ('environment' , '{ts escape="sql"}Environment{/ts}' , NULL, 1, 1, 0, 'name,label,description'), + ('activity_default_assignee' , '{ts escape="sql"}Activity default assignee{/ts}' , NULL, 1, 1, 0, 'name,label,description'), + ('entity_batch_extends' , '{ts escape="sql"}Entity Batch Extends{/ts}' , NULL, 1, 1, 0, 'name,label,description'); SELECT @option_group_id_pcm := max(id) from civicrm_option_group where name = 'preferred_communication_method'; SELECT @option_group_id_act := max(id) from civicrm_option_group where name = 'activity_type'; -- 2.25.1