From ca2e7d8487c02f73c3d1dd615e33a00d7b3a81e8 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Wed, 17 May 2023 01:20:07 -0700 Subject: [PATCH] Extract contact_smart_group_display, contact_view_options, contribution_status, event_type, participant_role, pcp_owner_notify, pcp_status, --- sql/civicrm_option_groups.php | 37 ------------ .../contact_smart_group_display.sqldata.php | 11 ++++ .../contact_view_options.sqldata.php | 27 +++++++++ .../contribution_status.sqldata.php | 17 ++++++ .../event_type.sqldata.php | 15 +++++ .../participant_role.sqldata.php | 13 +++++ .../pcp_owner_notify.sqldata.php | 11 ++++ .../pcp_status.sqldata.php | 11 ++++ xml/templates/civicrm_data.tpl | 58 ------------------- 9 files changed, 105 insertions(+), 95 deletions(-) create mode 100644 sql/civicrm_option_groups/contact_smart_group_display.sqldata.php create mode 100644 sql/civicrm_option_groups/contact_view_options.sqldata.php create mode 100644 sql/civicrm_option_groups/contribution_status.sqldata.php create mode 100644 sql/civicrm_option_groups/event_type.sqldata.php create mode 100644 sql/civicrm_option_groups/participant_role.sqldata.php create mode 100644 sql/civicrm_option_groups/pcp_owner_notify.sqldata.php create mode 100644 sql/civicrm_option_groups/pcp_status.sqldata.php diff --git a/sql/civicrm_option_groups.php b/sql/civicrm_option_groups.php index c44f7d5792..6a11b7c448 100644 --- a/sql/civicrm_option_groups.php +++ b/sql/civicrm_option_groups.php @@ -19,43 +19,6 @@ $readOptionGroups = function (): array { }; return $readOptionGroups() + [ - 'contribution_status' => CRM_Core_CodeGen_OptionGroup::create('contribution_status') - ->addMetadata([ - 'title' => ts('Contribution Status'), - 'is_locked' => '1', - ]), - 'pcp_status' => CRM_Core_CodeGen_OptionGroup::create('pcp_status') - ->addMetadata([ - 'title' => ts('PCP Status'), - 'is_locked' => '1', - ]), - 'pcp_owner_notify' => CRM_Core_CodeGen_OptionGroup::create('pcp_owner_notify') - ->addMetadata([ - 'title' => ts('PCP owner notifications'), - 'is_locked' => '1', - ]), - 'participant_role' => CRM_Core_CodeGen_OptionGroup::create('participant_role') - ->addMetadata([ - 'title' => ts('Participant Role'), - 'description' => ts('Define participant roles for events here (e.g. Attendee, Host, Speaker...). You can then assign roles and search for participants by role.'), - 'data_type' => 'Integer', - ]), - 'event_type' => CRM_Core_CodeGen_OptionGroup::create('event_type') - ->addMetadata([ - 'title' => ts('Event Type'), - 'description' => ts('Use Event Types to categorize your events. Event feeds can be filtered by Event Type and participant searches can use Event Type as a criteria.'), - 'data_type' => 'Integer', - ]), - 'contact_view_options' => CRM_Core_CodeGen_OptionGroup::create('contact_view_options') - ->addMetadata([ - 'title' => ts('Contact View Options'), - 'is_locked' => '1', - ]), - 'contact_smart_group_display' => CRM_Core_CodeGen_OptionGroup::create('contact_smart_group_display') - ->addMetadata([ - 'title' => ts('Contact Smart Group View Options'), - 'is_locked' => '1', - ]), 'contact_edit_options' => CRM_Core_CodeGen_OptionGroup::create('contact_edit_options') ->addMetadata([ 'title' => ts('Contact Edit Options'), diff --git a/sql/civicrm_option_groups/contact_smart_group_display.sqldata.php b/sql/civicrm_option_groups/contact_smart_group_display.sqldata.php new file mode 100644 index 0000000000..2dca5718cb --- /dev/null +++ b/sql/civicrm_option_groups/contact_smart_group_display.sqldata.php @@ -0,0 +1,11 @@ +addMetadata([ + 'title' => ts('Contact Smart Group View Options'), + 'is_locked' => 1, + ]) + ->addValues(['label', 'name', 'value'], [ + [ts('Show Smart Groups on Demand'), 'showondemand', 1], + [ts('Always Show Smart Groups'), 'alwaysshow', 2], + [ts('Hide Smart Groups'), 'hide', 3], + ]); diff --git a/sql/civicrm_option_groups/contact_view_options.sqldata.php b/sql/civicrm_option_groups/contact_view_options.sqldata.php new file mode 100644 index 0000000000..2e55bae7f4 --- /dev/null +++ b/sql/civicrm_option_groups/contact_view_options.sqldata.php @@ -0,0 +1,27 @@ +addMetadata([ + 'title' => ts('Contact View Options'), + 'is_locked' => 1, + ]) + ->addValues(['label', 'name', 'value', 'weight'], [ + + // NOTE: The original SQL had this inaccurate comment. It is unclear if the comment is inaccurate + // because the situation changed for the better or the worse. + // + // -- note that these are not ts'ed since they are used for logic in most cases and not display + // -- they are used for display only in the prefernces field settings + + [ts('Activities'), 'activity', 1, 1], + [ts('Relationships'), 'rel', 2, 2], + [ts('Groups'), 'group', 3, 3], + [ts('Notes'), 'note', 4, 4], + [ts('Tags'), 'tag', 5, 5], + [ts('Change Log'), 'log', 6, 6], + [ts('Contributions'), 'CiviContribute', 7, 7], + [ts('Memberships'), 'CiviMember', 8, 8], + [ts('Events'), 'CiviEvent', 9, 9], + [ts('Cases'), 'CiviCase', 10, 10], + [ts('Pledges'), 'CiviPledge', 13, 13], + [ts('Mailings'), 'CiviMail', 14, 14], + ]); diff --git a/sql/civicrm_option_groups/contribution_status.sqldata.php b/sql/civicrm_option_groups/contribution_status.sqldata.php new file mode 100644 index 0000000000..66992800e1 --- /dev/null +++ b/sql/civicrm_option_groups/contribution_status.sqldata.php @@ -0,0 +1,17 @@ +addMetadata([ + 'title' => ts('Contribution Status'), + 'is_locked' => 1, + ]) + ->addValues(['label', 'name', 'value', 'weight'], [ + [ts('Completed'), 'Completed', 1, 1, 'is_reserved' => 1], + [ts('Pending'), 'Pending', 2, 2, 'is_reserved' => 1], + [ts('Cancelled'), 'Cancelled', 3, 3, 'is_reserved' => 1], + [ts('Failed'), 'Failed', 4, 4, 'is_reserved' => 1], + [ts('Refunded'), 'Refunded', 7, 7, 'is_reserved' => 1], + [ts('Partially paid'), 'Partially paid', 8, 8, 'is_reserved' => 1], + [ts('Pending refund'), 'Pending refund', 9, 9, 'is_reserved' => 1], + [ts('Chargeback'), 'Chargeback', 10, 10, 'is_reserved' => 1], + [ts('Template'), 'Template', 11, 11, 'description' => ts('Status for contribution records which represent a template for a recurring contribution rather than an actual contribution. This status is transitional, to ensure that said contributions don\\\'t appear in reports. The is_template field is the preferred way to find and filter these contributions.'), 'is_reserved' => 1], + ]); diff --git a/sql/civicrm_option_groups/event_type.sqldata.php b/sql/civicrm_option_groups/event_type.sqldata.php new file mode 100644 index 0000000000..5d105ac525 --- /dev/null +++ b/sql/civicrm_option_groups/event_type.sqldata.php @@ -0,0 +1,15 @@ +addMetadata([ + 'title' => ts('Event Type'), + 'description' => ts('Use Event Types to categorize your events. Event feeds can be filtered by Event Type and participant searches can use Event Type as a criteria.'), + 'data_type' => 'Integer', + ]) + ->addValues(['label', 'name', 'value'], [ + [ts('Conference'), 'Conference', 1], + [ts('Exhibition'), 'Exhibition', 2], + [ts('Fundraiser'), 'Fundraiser', 3], + [ts('Meeting'), 'Meeting', 4], + [ts('Performance'), 'Performance', 5], + [ts('Workshop'), 'Workshop', 6], + ]); diff --git a/sql/civicrm_option_groups/participant_role.sqldata.php b/sql/civicrm_option_groups/participant_role.sqldata.php new file mode 100644 index 0000000000..a0ee672f3a --- /dev/null +++ b/sql/civicrm_option_groups/participant_role.sqldata.php @@ -0,0 +1,13 @@ +addMetadata([ + 'title' => ts('Participant Role'), + 'description' => ts('Define participant roles for events here (e.g. Attendee, Host, Speaker...). You can then assign roles and search for participants by role.'), + 'data_type' => 'Integer', + ]) + ->addValues(['label', 'name', 'value'], [ + [ts('Attendee'), 'Attendee', 1, 'filter' => 1], + [ts('Volunteer'), 'Volunteer', 2, 'filter' => 1], + [ts('Host'), 'Host', 3, 'filter' => 1], + [ts('Speaker'), 'Speaker', 4, 'filter' => 1], + ]); diff --git a/sql/civicrm_option_groups/pcp_owner_notify.sqldata.php b/sql/civicrm_option_groups/pcp_owner_notify.sqldata.php new file mode 100644 index 0000000000..8e046e8df0 --- /dev/null +++ b/sql/civicrm_option_groups/pcp_owner_notify.sqldata.php @@ -0,0 +1,11 @@ +addMetadata([ + 'title' => ts('PCP owner notifications'), + 'is_locked' => 1, + ]) + ->addValues(['label', 'name', 'value'], [ + [ts('Owner chooses whether to receive notifications'), 'owner_chooses', 1, 'is_default' => 1, 'is_reserved' => 1], + [ts('Notifications are sent to ALL owners'), 'all_owners', 2, 'is_reserved' => 1], + [ts('Notifications are NOT available'), 'no_notifications', 3, 'is_reserved' => 1], + ]); diff --git a/sql/civicrm_option_groups/pcp_status.sqldata.php b/sql/civicrm_option_groups/pcp_status.sqldata.php new file mode 100644 index 0000000000..ae0ffc8e89 --- /dev/null +++ b/sql/civicrm_option_groups/pcp_status.sqldata.php @@ -0,0 +1,11 @@ +addMetadata([ + 'title' => ts('PCP Status'), + 'is_locked' => 1, + ]) + ->addValues(['label', 'name', 'value'], [ + [ts('Waiting Review'), 'Waiting Review', 1, 'is_reserved' => 1], + [ts('Approved'), 'Approved', 2, 'is_reserved' => 1], + [ts('Not Approved'), 'Not Approved', 3, 'is_reserved' => 1], + ]); diff --git a/xml/templates/civicrm_data.tpl b/xml/templates/civicrm_data.tpl index 5378e3203d..0de8e694fc 100644 --- a/xml/templates/civicrm_data.tpl +++ b/xml/templates/civicrm_data.tpl @@ -133,13 +133,6 @@ VALUES {/php} 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'; -SELECT @option_group_id_pcpOwnerNotify := max(id) from civicrm_option_group where name = 'pcp_owner_notify'; -SELECT @option_group_id_pRole := max(id) from civicrm_option_group where name = 'participant_role'; -SELECT @option_group_id_etype := max(id) from civicrm_option_group where name = 'event_type'; -SELECT @option_group_id_cvOpt := max(id) from civicrm_option_group where name = 'contact_view_options'; -SELECT @option_group_id_csgOpt := max(id) from civicrm_option_group where name = 'contact_smart_group_display'; SELECT @option_group_id_ceOpt := max(id) from civicrm_option_group where name = 'contact_edit_options'; SELECT @option_group_id_asOpt := max(id) from civicrm_option_group where name = 'advanced_search_options'; SELECT @option_group_id_udOpt := max(id) from civicrm_option_group where name = 'user_dashboard_options'; @@ -219,57 +212,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_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), - (@option_group_id_cs, '{ts escape="sql"}Cancelled{/ts}' , 3, 'Cancelled' , NULL, 0, 0, 3, NULL, 0, 1, 1, NULL, NULL, NULL), - (@option_group_id_cs, '{ts escape="sql"}Failed{/ts}' , 4, 'Failed' , NULL, 0, 0, 4, NULL, 0, 1, 1, NULL, NULL, NULL), - (@option_group_id_cs, '{ts escape="sql"}Refunded{/ts}' , 7, 'Refunded' , NULL, 0, 0, 7, NULL, 0, 1, 1, NULL, NULL, NULL), - (@option_group_id_cs, '{ts escape="sql"}Partially paid{/ts}', 8, 'Partially paid', NULL, 0, 0, 8, NULL, 0, 1, 1, NULL, NULL, NULL), - (@option_group_id_cs, '{ts escape="sql"}Pending refund{/ts}', 9, 'Pending refund', NULL, 0, 0, 9, NULL, 0, 1, 1, NULL, NULL, NULL), - (@option_group_id_cs, '{ts escape="sql"}Chargeback{/ts}', 10, 'Chargeback', NULL, 0, 0, 10, NULL, 0, 1, 1, NULL, NULL, NULL), - (@option_group_id_cs, '{ts escape="sql"}Template{/ts}' , 11, 'Template', NULL, 0, 0, 11, '{ts escape="sql"}Status for contribution records which represent a template for a recurring contribution rather than an actual contribution. This status is transitional, to ensure that said contributions don\'t appear in reports. The is_template field is the preferred way to find and filter these contributions.{/ts}', 0, 1, 1, NULL, NULL, NULL), - - (@option_group_id_pcp, '{ts escape="sql"}Waiting Review{/ts}', 1, 'Waiting Review', NULL, 0, 0, 1, NULL, 0, 1, 1, NULL, NULL, NULL), - (@option_group_id_pcp, '{ts escape="sql"}Approved{/ts}' , 2, 'Approved' , NULL, 0, 0, 2, NULL, 0, 1, 1, NULL, NULL, NULL), - (@option_group_id_pcp, '{ts escape="sql"}Not Approved{/ts}' , 3, 'Not Approved' , NULL, 0, 0, 3, NULL, 0, 1, 1, NULL, NULL, NULL), - - (@option_group_id_pcpOwnerNotify, '{ts escape="sql"}Owner chooses whether to receive notifications{/ts}', 1, 'owner_chooses', NULL, 0, 1, 1, NULL, 0, 1, 1, NULL, NULL, NULL), - (@option_group_id_pcpOwnerNotify, '{ts escape="sql"}Notifications are sent to ALL owners{/ts}' , 2, 'all_owners' , NULL, 0, 0, 2, NULL, 0, 1, 1, NULL, NULL, NULL), - (@option_group_id_pcpOwnerNotify, '{ts escape="sql"}Notifications are NOT available{/ts}' , 3, 'no_notifications' , NULL, 0, 0, 3, NULL, 0, 1, 1, NULL, NULL, NULL), - - (@option_group_id_pRole, '{ts escape="sql"}Attendee{/ts}', 1, 'Attendee', NULL, 1, 0, 1, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_pRole, '{ts escape="sql"}Volunteer{/ts}', 2, 'Volunteer', NULL, 1, 0, 2, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_pRole, '{ts escape="sql"}Host{/ts}', 3, 'Host', NULL, 1, 0, 3, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_pRole, '{ts escape="sql"}Speaker{/ts}', 4, 'Speaker', NULL, 1, 0, 4, NULL, 0, 0, 1, NULL, NULL, NULL), - - (@option_group_id_etype, '{ts escape="sql"}Conference{/ts}', 1, 'Conference', NULL, 0, 0, 1, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_etype, '{ts escape="sql"}Exhibition{/ts}', 2, 'Exhibition', NULL, 0, 0, 2, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_etype, '{ts escape="sql"}Fundraiser{/ts}', 3, 'Fundraiser', NULL, 0, 0, 3, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_etype, '{ts escape="sql"}Meeting{/ts}', 4, 'Meeting', NULL, 0, 0, 4, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_etype, '{ts escape="sql"}Performance{/ts}',5, 'Performance', NULL, 0, 0, 5, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_etype, '{ts escape="sql"}Workshop{/ts}', 6, 'Workshop', NULL, 0, 0, 6, NULL, 0, 0, 1, NULL, NULL, NULL), - --- note that these are not ts'ed since they are used for logic in most cases and not display --- they are used for display only in the prefernces field settings - (@option_group_id_cvOpt, '{ts escape="sql"}Activities{/ts}' , 1, 'activity', NULL, 0, 0, 1, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_cvOpt, '{ts escape="sql"}Relationships{/ts}', 2, 'rel', NULL, 0, 0, 2, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_cvOpt, '{ts escape="sql"}Groups{/ts}' , 3, 'group', NULL, 0, 0, 3, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_cvOpt, '{ts escape="sql"}Notes{/ts}' , 4, 'note', NULL, 0, 0, 4, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_cvOpt, '{ts escape="sql"}Tags{/ts}' , 5, 'tag', NULL, 0, 0, 5, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_cvOpt, '{ts escape="sql"}Change Log{/ts}' , 6, 'log', NULL, 0, 0, 6, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_cvOpt, '{ts escape="sql"}Contributions{/ts}', 7, 'CiviContribute', NULL, 0, 0, 7, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_cvOpt, '{ts escape="sql"}Memberships{/ts}' , 8, 'CiviMember', NULL, 0, 0, 8, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_cvOpt, '{ts escape="sql"}Events{/ts}' , 9, 'CiviEvent', NULL, 0, 0, 9, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_cvOpt, '{ts escape="sql"}Cases{/ts}' , 10, 'CiviCase', NULL, 0, 0, 10, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_cvOpt, '{ts escape="sql"}Pledges{/ts}' , 13, 'CiviPledge', NULL, 0, 0, 13, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_cvOpt, '{ts escape="sql"}Mailings{/ts}' , 14, 'CiviMail', NULL, 0, 0, 14, NULL, 0, 0, 1, NULL, NULL, NULL), - - - (@option_group_id_csgOpt, '{ts escape="sql"}Show Smart Groups on Demand{/ts}',1, 'showondemand', NULL, 0, 0, 1, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_csgOpt, '{ts escape="sql"}Always Show Smart Groups{/ts}', 2, 'alwaysshow', NULL, 0, 0, 2, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_csgOpt, '{ts escape="sql"}Hide Smart Groups{/ts}' , 3, 'hide', NULL, 0, 0, 3, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_ceOpt, '{ts escape="sql"}Custom Data{/ts}' , 1, 'CustomData', NULL, 0, 0, 1, NULL, 0, 0, 1, NULL, NULL, NULL), (@option_group_id_ceOpt, '{ts escape="sql"}Address{/ts}' , 2, 'Address', NULL, 0, 0, 2, NULL, 0, 0, 1, NULL, NULL, NULL), (@option_group_id_ceOpt, '{ts escape="sql"}Communication Preferences{/ts}', 3, 'CommunicationPreferences', NULL, 0, 0, 3, NULL, 0, 0, 1, NULL, NULL, NULL), -- 2.25.1