From 3426e75ccd67e67392b9a1f2b1ce19e2c033c771 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Wed, 17 May 2023 01:04:30 -0700 Subject: [PATCH] Extract individual_prefix, individual_suffix --- sql/civicrm_option_groups.php | 10 ---------- .../individual_prefix.sqldata.php | 12 ++++++++++++ .../individual_suffix.sqldata.php | 16 ++++++++++++++++ xml/templates/civicrm_data.tpl | 16 ---------------- 4 files changed, 28 insertions(+), 26 deletions(-) create mode 100644 sql/civicrm_option_groups/individual_prefix.sqldata.php create mode 100644 sql/civicrm_option_groups/individual_suffix.sqldata.php diff --git a/sql/civicrm_option_groups.php b/sql/civicrm_option_groups.php index 416dd7ea0e..b8277bd495 100644 --- a/sql/civicrm_option_groups.php +++ b/sql/civicrm_option_groups.php @@ -19,16 +19,6 @@ $readOptionGroups = function (): array { }; return $readOptionGroups() + [ - 'individual_prefix' => CRM_Core_CodeGen_OptionGroup::create('individual_prefix') - ->addMetadata([ - 'title' => ts('Individual contact prefixes'), - 'description' => ts('CiviCRM is pre-configured with standard options for individual contact prefixes (Ms., Mr., Dr. etc.). Customize these options and add new ones as needed for your installation.'), - ]), - 'individual_suffix' => CRM_Core_CodeGen_OptionGroup::create('individual_suffix') - ->addMetadata([ - 'title' => ts('Individual contact suffixes'), - 'description' => ts('CiviCRM is pre-configured with standard options for individual contact name suffixes (Jr., Sr., II etc.). Customize these options and add new ones as needed for your installation.'), - ]), 'acl_role' => CRM_Core_CodeGen_OptionGroup::create('acl_role') ->addMetadata([ 'title' => ts('ACL Role'), diff --git a/sql/civicrm_option_groups/individual_prefix.sqldata.php b/sql/civicrm_option_groups/individual_prefix.sqldata.php new file mode 100644 index 0000000000..857054c4be --- /dev/null +++ b/sql/civicrm_option_groups/individual_prefix.sqldata.php @@ -0,0 +1,12 @@ +addMetadata([ + 'title' => ts('Individual contact prefixes'), + 'description' => ts('CiviCRM is pre-configured with standard options for individual contact prefixes (Ms., Mr., Dr. etc.). Customize these options and add new ones as needed for your installation.'), + ]) + ->addValues(['label', 'name', 'value'], [ + [ts('Mrs.'), 'Mrs.', 1], + [ts('Ms.'), 'Ms.', 2], + [ts('Mr.'), 'Mr.', 3], + [ts('Dr.'), 'Dr.', 4], + ]); diff --git a/sql/civicrm_option_groups/individual_suffix.sqldata.php b/sql/civicrm_option_groups/individual_suffix.sqldata.php new file mode 100644 index 0000000000..916c194433 --- /dev/null +++ b/sql/civicrm_option_groups/individual_suffix.sqldata.php @@ -0,0 +1,16 @@ +addMetadata([ + 'title' => ts('Individual contact suffixes'), + 'description' => ts('CiviCRM is pre-configured with standard options for individual contact name suffixes (Jr., Sr., II etc.). Customize these options and add new ones as needed for your installation.'), + ]) + ->addValues(['label', 'name', 'value'], [ + [ts('Jr.'), 'Jr.', 1], + [ts('Sr.'), 'Sr.', 2], + ['II', 'II', 3], + ['III', 'III', 4], + ['IV', 'IV', 5], + ['V', 'V', 6], + ['VI', 'VI', 7], + ['VII', 'VII', 8], + ]); diff --git a/xml/templates/civicrm_data.tpl b/xml/templates/civicrm_data.tpl index 6be0aefeb3..80712eb84d 100644 --- a/xml/templates/civicrm_data.tpl +++ b/xml/templates/civicrm_data.tpl @@ -132,8 +132,6 @@ VALUES } {/php} -SELECT @option_group_id_prefix := max(id) from civicrm_option_group where name = 'individual_prefix'; -SELECT @option_group_id_suffix := max(id) from civicrm_option_group where name = 'individual_suffix'; SELECT @option_group_id_aclRole := max(id) from civicrm_option_group where name = 'acl_role'; SELECT @option_group_id_acc := max(id) from civicrm_option_group where name = 'accept_creditcard'; SELECT @option_group_id_pi := max(id) from civicrm_option_group where name = 'payment_instrument'; @@ -223,20 +221,6 @@ INSERT INTO `civicrm_option_value` (`option_group_id`, `label`, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, `description`, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `visibility_id`, `icon`) VALUES - (@option_group_id_prefix, '{ts escape="sql"}Mrs.{/ts}', 1, 'Mrs.', NULL, 0, 0, 1, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_prefix, '{ts escape="sql"}Ms.{/ts}', 2, 'Ms.', NULL, 0, 0, 2, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_prefix, '{ts escape="sql"}Mr.{/ts}', 3, 'Mr.', NULL, 0, 0, 3, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_prefix, '{ts escape="sql"}Dr.{/ts}', 4, 'Dr.', NULL, 0, 0, 4, NULL, 0, 0, 1, NULL, NULL, NULL), - - (@option_group_id_suffix, '{ts escape="sql"}Jr.{/ts}', 1, 'Jr.', NULL, 0, 0, 1, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_suffix, '{ts escape="sql"}Sr.{/ts}', 2, 'Sr.', NULL, 0, 0, 2, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_suffix, 'II', 3, 'II', NULL, 0, 0, 3, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_suffix, 'III', 4, 'III', NULL, 0, 0, 4, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_suffix, 'IV', 5, 'IV', NULL, 0, 0, 5, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_suffix, 'V', 6, 'V', NULL, 0, 0, 6, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_suffix, 'VI', 7, 'VI', NULL, 0, 0, 7, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_suffix, 'VII', 8, 'VII', NULL, 0, 0, 8, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_aclRole, '{ts escape="sql"}Administrator{/ts}', 1, 'Admin', NULL, 0, 0, 1, NULL, 0, 0, 1, NULL, NULL, NULL), (@option_group_id_aclRole, '{ts escape="sql"}Authenticated{/ts}', 2, 'Auth' , NULL, 0, 0, 2, NULL, 0, 1, 1, NULL, NULL, NULL), -- 2.25.1