From f05b114e07f06b3e86b0579967a6403a613e635d Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Wed, 17 May 2023 03:12:49 -0700 Subject: [PATCH] Extract account_relationship, batch_mode, batch_status, batch_type, conference_slot, event_contacts, --- sql/civicrm_option_groups.php | 27 ------------ .../account_relationship.sqldata.php | 23 ++++++++++ .../batch_mode.sqldata.php | 10 +++++ .../batch_status.sqldata.php | 13 ++++++ .../batch_type.sqldata.php | 11 +++++ .../conference_slot.sqldata.php | 9 ++++ .../event_contacts.sqldata.php | 8 ++++ xml/templates/civicrm_data.tpl | 44 +------------------ 8 files changed, 75 insertions(+), 70 deletions(-) create mode 100644 sql/civicrm_option_groups/account_relationship.sqldata.php create mode 100644 sql/civicrm_option_groups/batch_mode.sqldata.php create mode 100644 sql/civicrm_option_groups/batch_status.sqldata.php create mode 100644 sql/civicrm_option_groups/batch_type.sqldata.php create mode 100644 sql/civicrm_option_groups/conference_slot.sqldata.php create mode 100644 sql/civicrm_option_groups/event_contacts.sqldata.php diff --git a/sql/civicrm_option_groups.php b/sql/civicrm_option_groups.php index 9c07d6dec1..eaaca1b92f 100644 --- a/sql/civicrm_option_groups.php +++ b/sql/civicrm_option_groups.php @@ -19,33 +19,6 @@ $readOptionGroups = function (): array { }; return $readOptionGroups() + [ - 'account_relationship' => CRM_Core_CodeGen_OptionGroup::create('account_relationship') - ->addMetadata([ - 'title' => ts('Account Relationship'), - ]), - 'event_contacts' => CRM_Core_CodeGen_OptionGroup::create('event_contacts') - ->addMetadata([ - 'title' => ts('Event Recipients'), - ]), - 'conference_slot' => CRM_Core_CodeGen_OptionGroup::create('conference_slot') - ->addMetadata([ - 'title' => ts('Conference Slot'), - ]), - 'batch_type' => CRM_Core_CodeGen_OptionGroup::create('batch_type') - ->addMetadata([ - 'title' => ts('Batch Type'), - 'is_locked' => '1', - ]), - 'batch_mode' => CRM_Core_CodeGen_OptionGroup::create('batch_mode') - ->addMetadata([ - 'title' => ts('Batch Mode'), - 'is_locked' => '1', - ]), - 'batch_status' => CRM_Core_CodeGen_OptionGroup::create('batch_status') - ->addMetadata([ - 'title' => ts('Batch Status'), - 'is_locked' => '1', - ]), 'sms_api_type' => CRM_Core_CodeGen_OptionGroup::create('sms_api_type') ->addMetadata([ 'title' => ts('Api Type'), diff --git a/sql/civicrm_option_groups/account_relationship.sqldata.php b/sql/civicrm_option_groups/account_relationship.sqldata.php new file mode 100644 index 0000000000..559cd58da5 --- /dev/null +++ b/sql/civicrm_option_groups/account_relationship.sqldata.php @@ -0,0 +1,23 @@ +addMetadata([ + 'title' => ts('Account Relationship'), + ]) + ->addValues(['label', 'name', 'value', 'description'], [ + [ts('Income Account is'), 'Income Account is', 1, ts('Income Account is'), 'is_default' => 1], + [ts('Credit/Contra Revenue Account is'), 'Credit/Contra Revenue Account is', 2, ts('Credit/Contra Revenue Account is')], + [ts('Accounts Receivable Account is'), 'Accounts Receivable Account is', 3, ts('Accounts Receivable Account is')], + [ts('Credit Liability Account is'), 'Credit Liability Account is', 4, ts('Credit Liability Account is'), 'is_active' => 0], + [ts('Expense Account is'), 'Expense Account is', 5, ts('Expense Account is')], + [ts('Asset Account is'), 'Asset Account is', 6, ts('Asset Account is')], + [ts('Cost of Sales Account is'), 'Cost of Sales Account is', 7, ts('Cost of Sales Account is')], + [ts('Premiums Inventory Account is'), 'Premiums Inventory Account is', 8, ts('Premiums Inventory Account is')], + [ts('Discounts Account is'), 'Discounts Account is', 9, ts('Discounts Account is')], + [ts('Sales Tax Account is'), 'Sales Tax Account is', 10, ts('Sales Tax Account is')], + [ts('Chargeback Account is'), 'Chargeback Account is', 11, ts('Chargeback Account is')], + [ts('Deferred Revenue Account is'), 'Deferred Revenue Account is', 12, ts('Deferred Revenue Account is')], + ]) + ->addDefaults([ + 'component_id' => 2, + 'is_reserved' => 1, + ]); diff --git a/sql/civicrm_option_groups/batch_mode.sqldata.php b/sql/civicrm_option_groups/batch_mode.sqldata.php new file mode 100644 index 0000000000..c2e553b6f7 --- /dev/null +++ b/sql/civicrm_option_groups/batch_mode.sqldata.php @@ -0,0 +1,10 @@ +addMetadata([ + 'title' => ts('Batch Mode'), + 'is_locked' => 1, + ]) + ->addValues(['label', 'name', 'value', 'description'], [ + [ts('Manual Batch'), 'Manual Batch', 1, ts('Manual Batch'), 'is_reserved' => 1, 'component_id' => 2], + [ts('Automatic Batch'), 'Automatic Batch', 2, ts('Automatic Batch'), 'is_reserved' => 1, 'component_id' => 2], + ]); diff --git a/sql/civicrm_option_groups/batch_status.sqldata.php b/sql/civicrm_option_groups/batch_status.sqldata.php new file mode 100644 index 0000000000..2f5cd6cc71 --- /dev/null +++ b/sql/civicrm_option_groups/batch_status.sqldata.php @@ -0,0 +1,13 @@ +addMetadata([ + 'title' => ts('Batch Status'), + 'is_locked' => 1, + ]) + ->addValues(['label', 'name', 'value'], [ + [ts('Open'), 'Open', 1], + [ts('Closed'), 'Closed', 2], + [ts('Data Entry'), 'Data Entry', 3], + [ts('Reopened'), 'Reopened', 4], + [ts('Exported'), 'Exported', 5], + ]); diff --git a/sql/civicrm_option_groups/batch_type.sqldata.php b/sql/civicrm_option_groups/batch_type.sqldata.php new file mode 100644 index 0000000000..3870705578 --- /dev/null +++ b/sql/civicrm_option_groups/batch_type.sqldata.php @@ -0,0 +1,11 @@ +addMetadata([ + 'title' => ts('Batch Type'), + 'is_locked' => 1, + ]) + ->addValues(['label', 'name', 'value'], [ + [ts('Contribution'), 'Contribution', 1], + [ts('Membership'), 'Membership', 2], + [ts('Pledge Payment'), 'Pledge Payment', 3], + ]); diff --git a/sql/civicrm_option_groups/conference_slot.sqldata.php b/sql/civicrm_option_groups/conference_slot.sqldata.php new file mode 100644 index 0000000000..d9a0aab176 --- /dev/null +++ b/sql/civicrm_option_groups/conference_slot.sqldata.php @@ -0,0 +1,9 @@ +addMetadata([ + 'title' => ts('Conference Slot'), + ]) + ->addValues(['label', 'name', 'value'], [ + [ts('Morning Sessions'), 'Morning Sessions', 1], + [ts('Evening Sessions'), 'Evening Sessions', 2], + ]); diff --git a/sql/civicrm_option_groups/event_contacts.sqldata.php b/sql/civicrm_option_groups/event_contacts.sqldata.php new file mode 100644 index 0000000000..1671b398ba --- /dev/null +++ b/sql/civicrm_option_groups/event_contacts.sqldata.php @@ -0,0 +1,8 @@ +addMetadata([ + 'title' => ts('Event Recipients'), + ]) + ->addValues(['label', 'name', 'value'], [ + [ts('Participant Role'), 'participant_role', 1], + ]); diff --git a/xml/templates/civicrm_data.tpl b/xml/templates/civicrm_data.tpl index 57cd4696ce..f18b76bb49 100644 --- a/xml/templates/civicrm_data.tpl +++ b/xml/templates/civicrm_data.tpl @@ -133,13 +133,8 @@ VALUES {/php} 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_ere := max(id) from civicrm_option_group where name = 'event_contacts'; -SELECT @option_group_id_conference_slot := max(id) from civicrm_option_group where name = 'conference_slot'; -SELECT @option_group_id_batch_type := max(id) from civicrm_option_group where name = 'batch_type'; -SELECT @option_group_id_batch_status := max(id) from civicrm_option_group where name = 'batch_status'; -SELECT @option_group_id_batch_mode := max(id) from civicrm_option_group where name = 'batch_mode'; + 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'; @@ -178,43 +173,6 @@ VALUES (@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), --- account_relationship - (@option_group_id_arel, '{ts escape="sql"}Income Account is{/ts}', 1, 'Income Account is', NULL, 0, 1, 1, 'Income Account is', 0, 1, 1, 2, NULL, NULL), - (@option_group_id_arel, '{ts escape="sql"}Credit/Contra Revenue Account is{/ts}', 2, 'Credit/Contra Revenue Account is', NULL, 0, 0, 2, 'Credit/Contra Revenue Account is', 0, 1, 1, 2, NULL, NULL), - (@option_group_id_arel, '{ts escape="sql"}Accounts Receivable Account is{/ts}', 3, 'Accounts Receivable Account is', NULL, 0, 0, 3, 'Accounts Receivable Account is', 0, 1, 1, 2, NULL, NULL), - (@option_group_id_arel, '{ts escape="sql"}Credit Liability Account is{/ts}', 4, 'Credit Liability Account is', NULL, 0, 0, 4, 'Credit Liability Account is', 0, 1, 0, 2, NULL, NULL), - (@option_group_id_arel, '{ts escape="sql"}Expense Account is{/ts}', 5, 'Expense Account is', NULL, 0, 0, 5, 'Expense Account is', 0, 1, 1, 2, NULL, NULL), - (@option_group_id_arel, '{ts escape="sql"}Asset Account is{/ts}', 6, 'Asset Account is', NULL, 0, 0, 6, 'Asset Account is', 0, 1, 1, 2, NULL, NULL), - (@option_group_id_arel, '{ts escape="sql"}Cost of Sales Account is{/ts}', 7, 'Cost of Sales Account is', NULL, 0, 0, 7, 'Cost of Sales Account is', 0, 1, 1, 2, NULL, NULL), - (@option_group_id_arel, '{ts escape="sql"}Premiums Inventory Account is{/ts}', 8, 'Premiums Inventory Account is', NULL, 0, 0, 8, 'Premiums Inventory Account is', 0, 1, 1, 2, NULL, NULL), - (@option_group_id_arel, '{ts escape="sql"}Discounts Account is{/ts}', 9, 'Discounts Account is', NULL, 0, 0, 9, 'Discounts Account is', 0, 1, 1, 2, NULL, NULL), - (@option_group_id_arel, '{ts escape="sql"}Sales Tax Account is{/ts}', 10, 'Sales Tax Account is', NULL, 0, 0, 10, 'Sales Tax Account is', 0, 1, 1, 2, NULL, NULL), - (@option_group_id_arel, '{ts escape="sql"}Chargeback Account is{/ts}', 11, 'Chargeback Account is', NULL, 0, 0, 11, 'Chargeback Account is', 0, 1, 1, 2, NULL, NULL), - (@option_group_id_arel, '{ts escape="sql"}Deferred Revenue Account is{/ts}', 12, 'Deferred Revenue Account is', NULL, 0, 0, 12, 'Deferred Revenue Account is', 0, 1, 1, 2, NULL, NULL), - --- event_contacts - (@option_group_id_ere, '{ts escape="sql"}Participant Role{/ts}', 1, 'participant_role', NULL, 0, 0, 1, NULL, 0, 0, 1, NULL, NULL, NULL), - --- default conference slots - (@option_group_id_conference_slot, '{ts escape="sql"}Morning Sessions{/ts}', 1, 'Morning Sessions', NULL, 0, 0, 1, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_conference_slot, '{ts escape="sql"}Evening Sessions{/ts}', 2, 'Evening Sessions', NULL, 0, 0, 2, NULL, 0, 0, 1, NULL, NULL, NULL), - --- default batch types - (@option_group_id_batch_type, '{ts escape="sql"}Contribution{/ts}', 1, 'Contribution', NULL, 0, 0, 1, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_batch_type, '{ts escape="sql"}Membership{/ts}', 2, 'Membership', NULL, 0, 0, 2, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_batch_type, '{ts escape="sql"}Pledge Payment{/ts}', 3, 'Pledge Payment', NULL, 0, 0, 3, NULL, 0, 0, 1, NULL, NULL, NULL), - --- default batch statuses - (@option_group_id_batch_status, '{ts escape="sql"}Open{/ts}', 1, 'Open', NULL, 0, 0, 1, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_batch_status, '{ts escape="sql"}Closed{/ts}', 2, 'Closed', NULL, 0, 0, 2, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_batch_status, '{ts escape="sql"}Data Entry{/ts}', 3, 'Data Entry', NULL, 0, 0, 3, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_batch_status, '{ts escape="sql"}Reopened{/ts}', 4, 'Reopened', NULL, 0, 0, 4, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_batch_status, '{ts escape="sql"}Exported{/ts}', 5, 'Exported', NULL, 0, 0, 5, NULL, 0, 0, 1, NULL, NULL, NULL), - --- default batch modes - (@option_group_id_batch_mode, '{ts escape="sql"}Manual Batch{/ts}', 1, 'Manual Batch', NULL, 0, 0, 1, 'Manual Batch', 0, 1, 1, 2, NULL, NULL), - (@option_group_id_batch_mode, '{ts escape="sql"}Automatic Batch{/ts}', 2, 'Automatic Batch', NULL, 0, 0, 2, 'Automatic Batch', 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), -- 2.25.1