From 494a2c91cababe52e802dd71a4a231b59ca4aa93 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Wed, 17 May 2023 01:11:23 -0700 Subject: [PATCH] Extract acl_role, accept_creditcard, payment_instrument --- sql/civicrm_option_groups.php | 15 --------------- .../accept_creditcard.sqldata.php | 12 ++++++++++++ sql/civicrm_option_groups/acl_role.sqldata.php | 9 +++++++++ .../payment_instrument.sqldata.php | 14 ++++++++++++++ xml/templates/civicrm_data.tpl | 15 --------------- 5 files changed, 35 insertions(+), 30 deletions(-) create mode 100644 sql/civicrm_option_groups/accept_creditcard.sqldata.php create mode 100644 sql/civicrm_option_groups/acl_role.sqldata.php create mode 100644 sql/civicrm_option_groups/payment_instrument.sqldata.php diff --git a/sql/civicrm_option_groups.php b/sql/civicrm_option_groups.php index b8277bd495..c44f7d5792 100644 --- a/sql/civicrm_option_groups.php +++ b/sql/civicrm_option_groups.php @@ -19,21 +19,6 @@ $readOptionGroups = function (): array { }; return $readOptionGroups() + [ - 'acl_role' => CRM_Core_CodeGen_OptionGroup::create('acl_role') - ->addMetadata([ - 'title' => ts('ACL Role'), - ]), - 'accept_creditcard' => CRM_Core_CodeGen_OptionGroup::create('accept_creditcard') - ->addMetadata([ - 'title' => ts('Accepted Credit Cards'), - 'description' => ts('The following credit card options will be offered to contributors using Online Contribution pages. You will need to verify which cards are accepted by your chosen Payment Processor and update these entries accordingly.IMPORTANT: These options do not control credit card/payment method choices for sites and/or contributors using the PayPal Express service (e.g. where billing information is collected on the Payment Processor\\\'s website).'), - ]), - 'payment_instrument' => CRM_Core_CodeGen_OptionGroup::create('payment_instrument') - ->addMetadata([ - 'title' => ts('Payment Methods'), - 'description' => ts('You may choose to record the payment method used for each contribution and fee. Reserved payment methods are required - you may modify their labels but they can not be deleted (e.g. Check, Credit Card, Debit Card). If your site requires additional payment methods, you can add them here. You can associate each payment method with a Financial Account which specifies where the payment is going (e.g. a bank account for checks and cash).'), - 'data_type' => 'Integer', - ]), 'contribution_status' => CRM_Core_CodeGen_OptionGroup::create('contribution_status') ->addMetadata([ 'title' => ts('Contribution Status'), diff --git a/sql/civicrm_option_groups/accept_creditcard.sqldata.php b/sql/civicrm_option_groups/accept_creditcard.sqldata.php new file mode 100644 index 0000000000..edc884d38a --- /dev/null +++ b/sql/civicrm_option_groups/accept_creditcard.sqldata.php @@ -0,0 +1,12 @@ +addMetadata([ + 'title' => ts('Accepted Credit Cards'), + 'description' => ts('The following credit card options will be offered to contributors using Online Contribution pages. You will need to verify which cards are accepted by your chosen Payment Processor and update these entries accordingly.IMPORTANT: These options do not control credit card/payment method choices for sites and/or contributors using the PayPal Express service (e.g. where billing information is collected on the Payment Processor\\\'s website).'), + ]) + ->addValues(['label', 'name', 'value'], [ + ['Visa', 'Visa', 1], + ['MasterCard', 'MasterCard', 2], + ['Amex', 'Amex', 3], + ['Discover', 'Discover', 4], + ]); diff --git a/sql/civicrm_option_groups/acl_role.sqldata.php b/sql/civicrm_option_groups/acl_role.sqldata.php new file mode 100644 index 0000000000..665979c68b --- /dev/null +++ b/sql/civicrm_option_groups/acl_role.sqldata.php @@ -0,0 +1,9 @@ +addMetadata([ + 'title' => ts('ACL Role'), + ]) + ->addValues(['label', 'name', 'value'], [ + [ts('Administrator'), 'Admin', 1], + [ts('Authenticated'), 'Auth', 2, 'is_reserved' => 1], + ]); diff --git a/sql/civicrm_option_groups/payment_instrument.sqldata.php b/sql/civicrm_option_groups/payment_instrument.sqldata.php new file mode 100644 index 0000000000..138a3c9f67 --- /dev/null +++ b/sql/civicrm_option_groups/payment_instrument.sqldata.php @@ -0,0 +1,14 @@ +addMetadata([ + 'title' => ts('Payment Methods'), + 'description' => ts('You may choose to record the payment method used for each contribution and fee. Reserved payment methods are required - you may modify their labels but they can not be deleted (e.g. Check, Credit Card, Debit Card). If your site requires additional payment methods, you can add them here. You can associate each payment method with a Financial Account which specifies where the payment is going (e.g. a bank account for checks and cash).'), + 'data_type' => 'Integer', + ]) + ->addValues(['label', 'name', 'value'], [ + [ts('Credit Card'), 'Credit Card', 1, 'is_reserved' => 1], + [ts('Debit Card'), 'Debit Card', 2, 'is_reserved' => 1], + [ts('Cash'), 'Cash', 3], + [ts('Check'), 'Check', 4, 'is_default' => 1, 'is_reserved' => 1], + [ts('EFT'), 'EFT', 5], + ]); diff --git a/xml/templates/civicrm_data.tpl b/xml/templates/civicrm_data.tpl index 80712eb84d..5378e3203d 100644 --- a/xml/templates/civicrm_data.tpl +++ b/xml/templates/civicrm_data.tpl @@ -132,8 +132,6 @@ VALUES } {/php} -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'; SELECT @option_group_id_cs := max(id) from civicrm_option_group where name = 'contribution_status'; SELECT @option_group_id_pcp := max(id) from civicrm_option_group where name = 'pcp_status'; @@ -221,19 +219,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_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), - - (@option_group_id_acc, 'Visa' , 1, 'Visa' , NULL, 0, 0, 1, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_acc, 'MasterCard', 2, 'MasterCard', NULL, 0, 0, 2, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_acc, 'Amex' , 3, 'Amex' , NULL, 0, 0, 3, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_acc, 'Discover' , 4, 'Discover' , NULL, 0, 0, 4, NULL, 0, 0, 1, NULL, NULL, NULL), - - (@option_group_id_pi, '{ts escape="sql"}Credit Card{/ts}', 1, 'Credit Card', NULL, 0, 0, 1, NULL, 0, 1, 1, NULL, NULL, NULL), - (@option_group_id_pi, '{ts escape="sql"}Debit Card{/ts}', 2, 'Debit Card', NULL, 0, 0, 2, NULL, 0, 1, 1, NULL, NULL, NULL), - (@option_group_id_pi, '{ts escape="sql"}Cash{/ts}', 3, 'Cash', NULL, 0, 0, 3, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_pi, '{ts escape="sql"}Check{/ts}', 4, 'Check', NULL, 0, 1, 4, NULL, 0, 1, 1, NULL, NULL, NULL), - (@option_group_id_pi, '{ts escape="sql"}EFT{/ts}', 5, 'EFT', NULL, 0, 0, 5, NULL, 0, 0, 1, NULL, NULL, NULL), (@option_group_id_cs, '{ts escape="sql"}Completed{/ts}' , 1, 'Completed' , NULL, 0, 0, 1, NULL, 0, 1, 1, NULL, NULL, NULL), (@option_group_id_cs, '{ts escape="sql"}Pending{/ts}' , 2, 'Pending' , NULL, 0, 0, 2, NULL, 0, 1, 1, NULL, NULL, NULL), -- 2.25.1