From 2e632981c63eff9b9bb766e37f9c65a51cfdd201 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Wed, 17 May 2023 03:50:02 -0700 Subject: [PATCH] Extract auto_renew_options, financial_account_type, financial_item_status, label_type, sms_api_type, sms_provider_name --- sql/civicrm_option_groups.php | 26 --------------- .../auto_renew_options.sqldata.php | 14 ++++++++ .../financial_account_type.sqldata.php | 12 +++++++ .../financial_item_status.sqldata.php | 11 +++++++ .../label_type.sqldata.php | 11 +++++++ .../sms_api_type.sqldata.php | 13 ++++++++ .../sms_provider_name.sqldata.php | 5 +++ xml/templates/civicrm_data.tpl | 33 +------------------ 8 files changed, 67 insertions(+), 58 deletions(-) create mode 100644 sql/civicrm_option_groups/auto_renew_options.sqldata.php create mode 100644 sql/civicrm_option_groups/financial_account_type.sqldata.php create mode 100644 sql/civicrm_option_groups/financial_item_status.sqldata.php create mode 100644 sql/civicrm_option_groups/label_type.sqldata.php create mode 100644 sql/civicrm_option_groups/sms_api_type.sqldata.php create mode 100644 sql/civicrm_option_groups/sms_provider_name.sqldata.php diff --git a/sql/civicrm_option_groups.php b/sql/civicrm_option_groups.php index eaaca1b92f..615d01b4a0 100644 --- a/sql/civicrm_option_groups.php +++ b/sql/civicrm_option_groups.php @@ -19,32 +19,6 @@ $readOptionGroups = function (): array { }; return $readOptionGroups() + [ - 'sms_api_type' => CRM_Core_CodeGen_OptionGroup::create('sms_api_type') - ->addMetadata([ - 'title' => ts('Api Type'), - ]), - 'sms_provider_name' => CRM_Core_CodeGen_OptionGroup::create('sms_provider_name') - ->addMetadata([ - 'title' => ts('Sms Provider Internal Name'), - ]), - 'auto_renew_options' => CRM_Core_CodeGen_OptionGroup::create('auto_renew_options') - ->addMetadata([ - 'title' => ts('Auto Renew Options'), - 'is_locked' => '1', - ]), - 'financial_account_type' => CRM_Core_CodeGen_OptionGroup::create('financial_account_type') - ->addMetadata([ - 'title' => ts('Financial Account Type'), - ]), - 'financial_item_status' => CRM_Core_CodeGen_OptionGroup::create('financial_item_status') - ->addMetadata([ - 'title' => ts('Financial Item Status'), - 'is_locked' => '1', - ]), - 'label_type' => CRM_Core_CodeGen_OptionGroup::create('label_type') - ->addMetadata([ - 'title' => ts('Label Type'), - ]), 'name_badge' => CRM_Core_CodeGen_OptionGroup::create('name_badge') ->addMetadata([ 'title' => ts('Name Badge Format'), diff --git a/sql/civicrm_option_groups/auto_renew_options.sqldata.php b/sql/civicrm_option_groups/auto_renew_options.sqldata.php new file mode 100644 index 0000000000..f6c5ccd974 --- /dev/null +++ b/sql/civicrm_option_groups/auto_renew_options.sqldata.php @@ -0,0 +1,14 @@ +addMetadata([ + 'title' => ts('Auto Renew Options'), + 'is_locked' => 1, + ]) + ->addValues(['label', 'name', 'value'], [ + [ts('Renewal Reminder (non-auto-renew memberships only)'), 'Renewal Reminder (non-auto-renew memberships only)', 1], + [ts('Auto-renew Memberships Only'), 'Auto-renew Memberships Only', 2], + [ts('Reminder for Both'), 'Reminder for Both', 3], + ]) + ->addDefaults([ + 'is_default' => NULL, + ]); diff --git a/sql/civicrm_option_groups/financial_account_type.sqldata.php b/sql/civicrm_option_groups/financial_account_type.sqldata.php new file mode 100644 index 0000000000..abbff8a415 --- /dev/null +++ b/sql/civicrm_option_groups/financial_account_type.sqldata.php @@ -0,0 +1,12 @@ +addMetadata([ + 'title' => ts('Financial Account Type'), + ]) + ->addValues(['label', 'name', 'value', 'description'], [ + [ts('Asset'), 'Asset', 1, ts('Things you own'), 'is_reserved' => 1, 'component_id' => 2], + [ts('Liability'), 'Liability', 2, ts('Things you owe, like a grant still to be disbursed'), 'is_reserved' => 1, 'component_id' => 2], + [ts('Revenue'), 'Revenue', 3, ts('Income from contributions and sales of tickets and memberships'), 'is_default' => 1, 'is_reserved' => 1, 'component_id' => 2], + [ts('Cost of Sales'), 'Cost of Sales', 4, ts('Costs incurred to get revenue, e.g. premiums for donations, dinner for a fundraising dinner ticket'), 'is_reserved' => 1, 'component_id' => 2], + [ts('Expenses'), 'Expenses', 5, ts('Things that are paid for that are consumable, e.g. grants disbursed'), 'is_reserved' => 1, 'component_id' => 2], + ]); diff --git a/sql/civicrm_option_groups/financial_item_status.sqldata.php b/sql/civicrm_option_groups/financial_item_status.sqldata.php new file mode 100644 index 0000000000..d1572e74cc --- /dev/null +++ b/sql/civicrm_option_groups/financial_item_status.sqldata.php @@ -0,0 +1,11 @@ +addMetadata([ + 'title' => ts('Financial Item Status'), + 'is_locked' => 1, + ]) + ->addValues(['label', 'name', 'value', 'weight', 'description'], [ + [ts('Paid'), 'Paid', 1, 1, ts('Paid'), 'is_reserved' => 1, 'component_id' => 2], + [ts('Unpaid'), 'Unpaid', 3, 1, ts('Unpaid'), 'is_reserved' => 1, 'component_id' => 2], + [ts('Partially paid'), 'Partially paid', 2, 2, ts('Partially paid'), 'is_reserved' => 1, 'component_id' => 2], + ]); diff --git a/sql/civicrm_option_groups/label_type.sqldata.php b/sql/civicrm_option_groups/label_type.sqldata.php new file mode 100644 index 0000000000..7ede3ba723 --- /dev/null +++ b/sql/civicrm_option_groups/label_type.sqldata.php @@ -0,0 +1,11 @@ +addMetadata([ + 'title' => ts('Label Type'), + ]) + ->addValues(['label', 'name', 'value'], [ + [ts('Event Badge'), 'Event Badge', 1], + ]) + ->addDefaults([ + 'is_default' => NULL, + ]); diff --git a/sql/civicrm_option_groups/sms_api_type.sqldata.php b/sql/civicrm_option_groups/sms_api_type.sqldata.php new file mode 100644 index 0000000000..7131c8a84f --- /dev/null +++ b/sql/civicrm_option_groups/sms_api_type.sqldata.php @@ -0,0 +1,13 @@ +addMetadata([ + 'title' => ts('Api Type'), + ]) + ->addValues(['label', 'name', 'value'], [ + ['http', 'http', 1, 'is_reserved' => 1], + ['xml', 'xml', 2, 'is_reserved' => 1], + ['smtp', 'smtp', 3, 'is_reserved' => 1], + ]) + ->addDefaults([ + 'filter' => NULL, + ]); diff --git a/sql/civicrm_option_groups/sms_provider_name.sqldata.php b/sql/civicrm_option_groups/sms_provider_name.sqldata.php new file mode 100644 index 0000000000..6a0bc0ad5f --- /dev/null +++ b/sql/civicrm_option_groups/sms_provider_name.sqldata.php @@ -0,0 +1,5 @@ +addMetadata([ + 'title' => ts('Sms Provider Internal Name'), + ]); diff --git a/xml/templates/civicrm_data.tpl b/xml/templates/civicrm_data.tpl index f18b76bb49..e83886ae79 100644 --- a/xml/templates/civicrm_data.tpl +++ b/xml/templates/civicrm_data.tpl @@ -134,13 +134,8 @@ VALUES SELECT @option_group_id_pi := max(id) from civicrm_option_group where name = 'payment_instrument'; SELECT @option_group_id_arel := max(id) from civicrm_option_group where name = 'account_relationship'; - -SELECT @option_group_id_sms_api_type := max(id) from civicrm_option_group where name = 'sms_api_type'; -SELECT @option_group_id_sms_provider_name := max(id) from civicrm_option_group where name = 'sms_provider_name'; -SELECT @option_group_id_aro := max(id) from civicrm_option_group where name = 'auto_renew_options'; SELECT @option_group_id_fat := max(id) from civicrm_option_group where name = 'financial_account_type'; -SELECT @option_group_id_financial_item_status := max(id) from civicrm_option_group where name = 'financial_item_status'; -SELECT @option_group_id_label_type := max(id) from civicrm_option_group where name = 'label_type'; + SELECT @option_group_id_name_badge := max(id) from civicrm_option_group where name = 'name_badge'; SELECT @option_group_id_communication_style := max(id) from civicrm_option_group where name = 'communication_style'; SELECT @option_group_id_msg_mode := max(id) from civicrm_option_group where name = 'msg_mode'; @@ -165,32 +160,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 --- financial_account_type --- grouping field is specific to Quickbooks for mapping to .iif format - (@option_group_id_fat, '{ts escape="sql"}Asset{/ts}', 1, 'Asset', NULL, 0, 0, 1, 'Things you own', 0, 1, 1, 2, NULL, NULL), - (@option_group_id_fat, '{ts escape="sql"}Liability{/ts}', 2, 'Liability', NULL, 0, 0, 2, 'Things you owe, like a grant still to be disbursed', 0, 1, 1, 2, NULL, NULL), - (@option_group_id_fat, '{ts escape="sql"}Revenue{/ts}', 3, 'Revenue', NULL, 0, 1, 3, 'Income from contributions and sales of tickets and memberships', 0, 1, 1, 2, NULL, NULL), - (@option_group_id_fat, '{ts escape="sql"}Cost of Sales{/ts}', 4, 'Cost of Sales', NULL, 0, 0, 4, 'Costs incurred to get revenue, e.g. premiums for donations, dinner for a fundraising dinner ticket', 0, 1, 1, 2, NULL, NULL), - (@option_group_id_fat, '{ts escape="sql"}Expenses{/ts}', 5, 'Expenses', NULL, 0, 0, 5, 'Things that are paid for that are consumable, e.g. grants disbursed', 0, 1, 1, 2, NULL, NULL), - --- Financial Item Status - (@option_group_id_financial_item_status, '{ts escape="sql"}Paid{/ts}', 1, 'Paid', NULL, 0, 0, 1, 'Paid', 0, 1, 1, 2, NULL, NULL), - (@option_group_id_financial_item_status, '{ts escape="sql"}Partially paid{/ts}', 2, 'Partially paid', NULL, 0, 0, 2, 'Partially paid', 0, 1, 1, 2, NULL, NULL), - (@option_group_id_financial_item_status, '{ts escape="sql"}Unpaid{/ts}', 3, 'Unpaid', NULL, 0, 0, 1, 'Unpaid', 0, 1, 1, 2, NULL, NULL), - --- sms_api_type - (@option_group_id_sms_api_type, 'http', 1, 'http', NULL, NULL, 0, 1, NULL, 0, 1, 1, NULL, NULL, NULL), - (@option_group_id_sms_api_type, 'xml', 2, 'xml', NULL, NULL, 0, 2, NULL, 0, 1, 1, NULL, NULL, NULL), - (@option_group_id_sms_api_type, 'smtp', 3, 'smtp', NULL, NULL, 0, 3, NULL, 0, 1, 1, NULL, NULL, NULL), - --- auto renew options - (@option_group_id_aro, '{ts escape="sql"}Renewal Reminder (non-auto-renew memberships only){/ts}', 1, 'Renewal Reminder (non-auto-renew memberships only)', NULL, 0, NULL, 1, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_aro, '{ts escape="sql"}Auto-renew Memberships Only{/ts}', 2, 'Auto-renew Memberships Only', NULL, 0, NULL, 2, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_aro, '{ts escape="sql"}Reminder for Both{/ts}', 3, 'Reminder for Both', NULL, 0, NULL, 3, NULL, 0, 0, 1, NULL, NULL, NULL), - --- Label Type - (@option_group_id_label_type, '{ts escape="sql"}Event Badge{/ts}', 1, 'Event Badge', NULL, 0, NULL, 1, NULL, 0, 0, 1, NULL, NULL, NULL), - -- Name Label format (@option_group_id_name_badge, '{ts escape="sql"}Avery 5395{/ts}', '{literal}{"name":"Avery 5395","paper-size":"a4","metric":"mm","lMargin":15,"tMargin":26,"NX":2,"NY":4,"SpaceX":10,"SpaceY":5,"width":83,"height":57,"font-size":12,"orientation":"portrait","font-name":"helvetica","font-style":"","lPadding":3,"tPadding":3}{/literal}', 'Avery 5395', NULL, 0, 0, 1, NULL, 0, 0, 1, NULL, NULL, NULL), (@option_group_id_name_badge, '{ts escape="sql"}A6 Badge Portrait 150x106{/ts}', '{literal}{"paper-size":"a4","orientation":"landscape","font-name":"times","font-size":6,"font-style":"","NX":2,"NY":1,"metric":"mm","lMargin":25,"tMargin":27,"SpaceX":0,"SpaceY":35,"width":106,"height":150,"lPadding":5,"tPadding":5}{/literal}', 'A6 Badge Portrait 150x106', NULL, 0, 0, 2, NULL, 0, 0, 1, NULL, NULL, NULL), -- 2.25.1