From 9d32bd9d471449a63ac4442514a699f265839c13 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Wed, 17 May 2023 04:09:50 -0700 Subject: [PATCH] Extract activity_default_assignee, entity_batch_extends, file_type --- sql/civicrm_option_groups.php | 16 +--------------- .../activity_default_assignee.sqldata.php | 11 +++++++++++ .../entity_batch_extends.sqldata.php | 8 ++++++++ .../file_type.sqldata.php | 6 ++++++ xml/templates/civicrm_data.tpl | 19 ------------------- 5 files changed, 26 insertions(+), 34 deletions(-) create mode 100644 sql/civicrm_option_groups/activity_default_assignee.sqldata.php create mode 100644 sql/civicrm_option_groups/entity_batch_extends.sqldata.php create mode 100644 sql/civicrm_option_groups/file_type.sqldata.php diff --git a/sql/civicrm_option_groups.php b/sql/civicrm_option_groups.php index 13e9611fca..3a4e6b0126 100644 --- a/sql/civicrm_option_groups.php +++ b/sql/civicrm_option_groups.php @@ -18,18 +18,4 @@ $readOptionGroups = function (): array { return $result; }; -return $readOptionGroups() + [ - 'activity_default_assignee' => CRM_Core_CodeGen_OptionGroup::create('activity_default_assignee') - ->addMetadata([ - 'title' => ts('Activity default assignee'), - ]), - 'entity_batch_extends' => CRM_Core_CodeGen_OptionGroup::create('entity_batch_extends') - ->addMetadata([ - 'title' => ts('Entity Batch Extends'), - ]), - 'file_type' => CRM_Core_CodeGen_OptionGroup::create('file_type') - ->addMetadata([ - 'title' => ts('File Type'), - 'data_type' => 'Integer', - ]), -]; +return $readOptionGroups(); diff --git a/sql/civicrm_option_groups/activity_default_assignee.sqldata.php b/sql/civicrm_option_groups/activity_default_assignee.sqldata.php new file mode 100644 index 0000000000..a33e63108d --- /dev/null +++ b/sql/civicrm_option_groups/activity_default_assignee.sqldata.php @@ -0,0 +1,11 @@ +addMetadata([ + 'title' => ts('Activity default assignee'), + ]) + ->addValues(['label', 'name', 'value', 'weight'], [ + [ts('None'), 'NONE', 1, 1, 'is_default' => 1], + [ts('By relationship to case client'), 'BY_RELATIONSHIP', 2, 1], + [ts('Specific contact'), 'SPECIFIC_CONTACT', 3, 1], + [ts('User creating the case'), 'USER_CREATING_THE_CASE', 4, 1], + ]); diff --git a/sql/civicrm_option_groups/entity_batch_extends.sqldata.php b/sql/civicrm_option_groups/entity_batch_extends.sqldata.php new file mode 100644 index 0000000000..bfed5b7850 --- /dev/null +++ b/sql/civicrm_option_groups/entity_batch_extends.sqldata.php @@ -0,0 +1,8 @@ +addMetadata([ + 'title' => ts('Entity Batch Extends'), + ]) + ->addValues(['label', 'name', 'value'], [ + [ts('Financial Transactions'), 'civicrm_financial_trxn', 'civicrm_financial_trxn', 'is_default' => 1, 'component_id' => 2], + ]); diff --git a/sql/civicrm_option_groups/file_type.sqldata.php b/sql/civicrm_option_groups/file_type.sqldata.php new file mode 100644 index 0000000000..c0cd7ca791 --- /dev/null +++ b/sql/civicrm_option_groups/file_type.sqldata.php @@ -0,0 +1,6 @@ +addMetadata([ + 'title' => ts('File Type'), + 'data_type' => 'Integer', + ]); diff --git a/xml/templates/civicrm_data.tpl b/xml/templates/civicrm_data.tpl index 9079d49be6..b3493092b6 100644 --- a/xml/templates/civicrm_data.tpl +++ b/xml/templates/civicrm_data.tpl @@ -136,9 +136,6 @@ SELECT @option_group_id_pi := max(id) from civicrm_option_group wher SELECT @option_group_id_arel := max(id) from civicrm_option_group where name = 'account_relationship'; SELECT @option_group_id_fat := max(id) from civicrm_option_group where name = 'financial_account_type'; -SELECT @option_group_id_default_assignee := max(id) from civicrm_option_group where name = 'activity_default_assignee'; -SELECT @option_group_id_entity_batch_extends := max(id) from civicrm_option_group where name = 'entity_batch_extends'; - SELECT @contributeCompId := max(id) FROM civicrm_component where name = 'CiviContribute'; SELECT @eventCompId := max(id) FROM civicrm_component where name = 'CiviEvent'; SELECT @memberCompId := max(id) FROM civicrm_component where name = 'CiviMember'; @@ -147,22 +144,6 @@ SELECT @caseCompId := max(id) FROM civicrm_component where name = 'CiviCas SELECT @campaignCompId := max(id) FROM civicrm_component where name = 'CiviCampaign'; SELECT @mailCompId := max(id) FROM civicrm_component where name = 'CiviMail'; -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 - --- CiviCase - Activity Assignee Default --- (`option_group_id`, `label`, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, `description`, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `visibility_id`, `icon`) -(@option_group_id_default_assignee, '{ts escape="sql"}None{/ts}', '1', 'NONE', NULL, 0, 1, 1, NULL, 0, 0, 1, NULL, NULL, NULL), -(@option_group_id_default_assignee, '{ts escape="sql"}By relationship to case client{/ts}', '2', 'BY_RELATIONSHIP', NULL, 0, 0, 1, NULL, 0, 0, 1, NULL, NULL, NULL), -(@option_group_id_default_assignee, '{ts escape="sql"}Specific contact{/ts}', '3', 'SPECIFIC_CONTACT', NULL, 0, 0, 1, NULL, 0, 0, 1, NULL, NULL, NULL), -(@option_group_id_default_assignee, '{ts escape="sql"}User creating the case{/ts}', '4', 'USER_CREATING_THE_CASE', NULL, 0, 0, 1, NULL, 0, 0, 1, NULL, NULL, NULL), - --- Entity Batch options --- (`option_group_id`, `label`, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, `description`, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `visibility_id`, `icon`) -(@option_group_id_entity_batch_extends, '{ts escape="sql"}Financial Transactions{/ts}', 'civicrm_financial_trxn', 'civicrm_financial_trxn', NULL, 0, 1, 1, NULL, 0, 0, 1, @contributeCompId, NULL, NULL); - - -- financial accounts SELECT @opval := value FROM civicrm_option_value WHERE name = 'Revenue' and option_group_id = @option_group_id_fat; SELECT @opexp := value FROM civicrm_option_value WHERE name = 'Expenses' and option_group_id = @option_group_id_fat; -- 2.25.1