From 037dec394146d64253e29979c9d7411111e01ed1 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Wed, 17 May 2023 02:00:10 -0700 Subject: [PATCH] Extract case_status, case_type, from_email_address, mapping_type... And also participant_listing phone_type, recur_frequency_units, safe_file_extension, wysiwyg_editor --- sql/civicrm_option_groups.php | 39 ----------- .../case_status.sqldata.php | 11 ++++ .../case_type.sqldata.php | 5 ++ .../from_email_address.sqldata.php | 9 +++ .../mapping_type.sqldata.php | 21 ++++++ .../participant_listing.sqldata.php | 10 +++ .../phone_type.sqldata.php | 12 ++++ .../recur_frequency_units.sqldata.php | 11 ++++ .../safe_file_extension.sqldata.php | 23 +++++++ .../wysiwyg_editor.sqldata.php | 9 +++ xml/templates/civicrm_data.tpl | 65 ------------------- 11 files changed, 111 insertions(+), 104 deletions(-) create mode 100644 sql/civicrm_option_groups/case_status.sqldata.php create mode 100644 sql/civicrm_option_groups/case_type.sqldata.php create mode 100644 sql/civicrm_option_groups/from_email_address.sqldata.php create mode 100644 sql/civicrm_option_groups/mapping_type.sqldata.php create mode 100644 sql/civicrm_option_groups/participant_listing.sqldata.php create mode 100644 sql/civicrm_option_groups/phone_type.sqldata.php create mode 100644 sql/civicrm_option_groups/recur_frequency_units.sqldata.php create mode 100644 sql/civicrm_option_groups/safe_file_extension.sqldata.php create mode 100644 sql/civicrm_option_groups/wysiwyg_editor.sqldata.php diff --git a/sql/civicrm_option_groups.php b/sql/civicrm_option_groups.php index cf9e9c7ee3..3bba5cb927 100644 --- a/sql/civicrm_option_groups.php +++ b/sql/civicrm_option_groups.php @@ -19,45 +19,6 @@ $readOptionGroups = function (): array { }; return $readOptionGroups() + [ - 'case_type' => CRM_Core_CodeGen_OptionGroup::create('case_type') - ->addMetadata([ - 'title' => ts('Case Type'), - ]), - 'case_status' => CRM_Core_CodeGen_OptionGroup::create('case_status') - ->addMetadata([ - 'title' => ts('Case Status'), - 'option_value_fields' => 'name,label,description,color', - ]), - 'participant_listing' => CRM_Core_CodeGen_OptionGroup::create('participant_listing') - ->addMetadata([ - 'title' => ts('Participant Listing'), - ]), - 'safe_file_extension' => CRM_Core_CodeGen_OptionGroup::create('safe_file_extension') - ->addMetadata([ - 'title' => ts('Safe File Extension'), - ]), - 'from_email_address' => CRM_Core_CodeGen_OptionGroup::create('from_email_address') - ->addMetadata([ - 'title' => ts('From Email Address'), - 'description' => ts('By default, CiviCRM uses the primary email address of the logged in user as the FROM address when sending emails to contacts. However, you can use this page to define one or more general Email Addresses that can be selected as an alternative. EXAMPLE: "Client Services" .'), - ]), - 'mapping_type' => CRM_Core_CodeGen_OptionGroup::create('mapping_type') - ->addMetadata([ - 'title' => ts('Mapping Type'), - 'is_locked' => '1', - ]), - 'wysiwyg_editor' => CRM_Core_CodeGen_OptionGroup::create('wysiwyg_editor') - ->addMetadata([ - 'title' => ts('WYSIWYG Editor'), - ]), - 'recur_frequency_units' => CRM_Core_CodeGen_OptionGroup::create('recur_frequency_units') - ->addMetadata([ - 'title' => ts('Recurring Frequency Units'), - ]), - 'phone_type' => CRM_Core_CodeGen_OptionGroup::create('phone_type') - ->addMetadata([ - 'title' => ts('Phone Type'), - ]), 'custom_data_type' => CRM_Core_CodeGen_OptionGroup::create('custom_data_type') ->addMetadata([ 'title' => ts('Custom Data Type'), diff --git a/sql/civicrm_option_groups/case_status.sqldata.php b/sql/civicrm_option_groups/case_status.sqldata.php new file mode 100644 index 0000000000..b22bf24cac --- /dev/null +++ b/sql/civicrm_option_groups/case_status.sqldata.php @@ -0,0 +1,11 @@ +addMetadata([ + 'title' => ts('Case Status'), + 'option_value_fields' => 'name,label,description,color', + ]) + ->addValues(['label', 'name', 'value'], [ + [ts('Ongoing'), 'Open', 1, 'grouping' => 'Opened', 'is_default' => 1, 'is_reserved' => 1], + [ts('Resolved'), 'Closed', 2, 'grouping' => 'Closed', 'is_reserved' => 1], + [ts('Urgent'), 'Urgent', 3, 'grouping' => 'Opened'], + ]); diff --git a/sql/civicrm_option_groups/case_type.sqldata.php b/sql/civicrm_option_groups/case_type.sqldata.php new file mode 100644 index 0000000000..62d2ef7d97 --- /dev/null +++ b/sql/civicrm_option_groups/case_type.sqldata.php @@ -0,0 +1,5 @@ +addMetadata([ + 'title' => ts('Case Type'), + ]); diff --git a/sql/civicrm_option_groups/from_email_address.sqldata.php b/sql/civicrm_option_groups/from_email_address.sqldata.php new file mode 100644 index 0000000000..380a8c6aaa --- /dev/null +++ b/sql/civicrm_option_groups/from_email_address.sqldata.php @@ -0,0 +1,9 @@ +addMetadata([ + 'title' => ts('From Email Address'), + 'description' => ts('By default, CiviCRM uses the primary email address of the logged in user as the FROM address when sending emails to contacts. However, you can use this page to define one or more general Email Addresses that can be selected as an alternative. EXAMPLE: "Client Services" .'), + ]) + ->addValues(['label', 'name', 'value', 'description'], [ + ['"FIXME" ', '"FIXME" ', 1, ts('Default domain email address and from name.'), 'is_default' => 1, 'domain_id' => new CRM_Utils_SQL_Literal('@domainID')], + ]); diff --git a/sql/civicrm_option_groups/mapping_type.sqldata.php b/sql/civicrm_option_groups/mapping_type.sqldata.php new file mode 100644 index 0000000000..035936fb14 --- /dev/null +++ b/sql/civicrm_option_groups/mapping_type.sqldata.php @@ -0,0 +1,21 @@ +addMetadata([ + 'title' => ts('Mapping Type'), + 'is_locked' => 1, + ]) + ->addValues(['label', 'name', 'value', 'weight'], [ + [ts('Search Builder'), 'Search Builder', 1, 1, 'is_reserved' => 1], + [ts('Import Contact'), 'Import Contact', 2, 2, 'is_reserved' => 1], + [ts('Import Activity'), 'Import Activity', 3, 3, 'is_reserved' => 1], + [ts('Import Contribution'), 'Import Contribution', 4, 4, 'is_reserved' => 1], + [ts('Import Membership'), 'Import Membership', 5, 5, 'is_reserved' => 1], + [ts('Import Participant'), 'Import Participant', 6, 6, 'is_reserved' => 1], + [ts('Export Contact'), 'Export Contact', 7, 7, 'is_reserved' => 1], + [ts('Export Contribution'), 'Export Contribution', 8, 8, 'is_reserved' => 1], + [ts('Export Membership'), 'Export Membership', 9, 9, 'is_reserved' => 1], + [ts('Export Participant'), 'Export Participant', 10, 10, 'is_reserved' => 1], + [ts('Export Pledge'), 'Export Pledge', 11, 11, 'is_reserved' => 1], + [ts('Export Case'), 'Export Case', 12, 12, 'is_reserved' => 1], + [ts('Export Activity'), 'Export Activity', 14, 14, 'is_reserved' => 1], + ]); diff --git a/sql/civicrm_option_groups/participant_listing.sqldata.php b/sql/civicrm_option_groups/participant_listing.sqldata.php new file mode 100644 index 0000000000..1b546edb9b --- /dev/null +++ b/sql/civicrm_option_groups/participant_listing.sqldata.php @@ -0,0 +1,10 @@ +addMetadata([ + 'title' => ts('Participant Listing'), + ]) + ->addValues(['label', 'name', 'value', 'description'], [ + [ts('Name Only'), 'Name Only', 1, ts('CRM_Event_Page_ParticipantListing_Name'), 'is_reserved' => 1], + [ts('Name and Email'), 'Name and Email', 2, ts('CRM_Event_Page_ParticipantListing_NameAndEmail'), 'is_reserved' => 1], + [ts('Name, Status and Register Date'), 'Name, Status and Register Date', 3, ts('CRM_Event_Page_ParticipantListing_NameStatusAndDate'), 'is_reserved' => 1], + ]); diff --git a/sql/civicrm_option_groups/phone_type.sqldata.php b/sql/civicrm_option_groups/phone_type.sqldata.php new file mode 100644 index 0000000000..70518a2a68 --- /dev/null +++ b/sql/civicrm_option_groups/phone_type.sqldata.php @@ -0,0 +1,12 @@ +addMetadata([ + 'title' => ts('Phone Type'), + ]) + ->addValues(['label', 'name', 'value'], [ + [ts('Phone'), 'Phone', 1], + [ts('Mobile'), 'Mobile', 2], + [ts('Fax'), 'Fax', 3], + [ts('Pager'), 'Pager', 4], + [ts('Voicemail'), 'Voicemail', 5], + ]); diff --git a/sql/civicrm_option_groups/recur_frequency_units.sqldata.php b/sql/civicrm_option_groups/recur_frequency_units.sqldata.php new file mode 100644 index 0000000000..1f0ca9b05f --- /dev/null +++ b/sql/civicrm_option_groups/recur_frequency_units.sqldata.php @@ -0,0 +1,11 @@ +addMetadata([ + 'title' => ts('Recurring Frequency Units'), + ]) + ->addValues(['label', 'name', 'value'], [ + [ts('day'), 'day', 'day', 'is_reserved' => 1], + [ts('week'), 'week', 'week', 'is_reserved' => 1], + [ts('month'), 'month', 'month', 'is_reserved' => 1], + [ts('year'), 'year', 'year', 'is_reserved' => 1], + ]); diff --git a/sql/civicrm_option_groups/safe_file_extension.sqldata.php b/sql/civicrm_option_groups/safe_file_extension.sqldata.php new file mode 100644 index 0000000000..bf04c0e314 --- /dev/null +++ b/sql/civicrm_option_groups/safe_file_extension.sqldata.php @@ -0,0 +1,23 @@ +addMetadata([ + 'title' => ts('Safe File Extension'), + ]) + ->addValues(['label', 'name', 'value'], [ + ['jpg', 'jpg', 1], + ['jpeg', 'jpeg', 2], + ['png', 'png', 3], + ['gif', 'gif', 4], + ['txt', 'txt', 5], + ['pdf', 'pdf', 6], + ['doc', 'doc', 7], + ['xls', 'xls', 8], + ['rtf', 'rtf', 9], + ['csv', 'csv', 10], + ['ppt', 'ppt', 11], + ['docx', 'docx', 12], + ['xlsx', 'xlsx', 13], + ['odt', 'odt', 14], + ['ics', 'ics', 15], + ['pptx', 'pptx', 16], + ]); diff --git a/sql/civicrm_option_groups/wysiwyg_editor.sqldata.php b/sql/civicrm_option_groups/wysiwyg_editor.sqldata.php new file mode 100644 index 0000000000..ea356e186b --- /dev/null +++ b/sql/civicrm_option_groups/wysiwyg_editor.sqldata.php @@ -0,0 +1,9 @@ +addMetadata([ + 'title' => ts('WYSIWYG Editor'), + ]) + ->addValues(['label', 'name', 'value'], [ + [ts('Textarea'), 'Textarea', 1, 'is_reserved' => 1], + [ts('CKEditor 4'), 'CKEditor', 2, 'is_reserved' => 1], + ]); diff --git a/xml/templates/civicrm_data.tpl b/xml/templates/civicrm_data.tpl index 38b9b5a23f..cb2c4947ab 100644 --- a/xml/templates/civicrm_data.tpl +++ b/xml/templates/civicrm_data.tpl @@ -134,15 +134,6 @@ VALUES SELECT @option_group_id_pi := max(id) from civicrm_option_group where name = 'payment_instrument'; -SELECT @option_group_id_ct := max(id) from civicrm_option_group where name = 'case_type'; -SELECT @option_group_id_cas := max(id) from civicrm_option_group where name = 'case_status'; -SELECT @option_group_id_pl := max(id) from civicrm_option_group where name = 'participant_listing'; -SELECT @option_group_id_sfe := max(id) from civicrm_option_group where name = 'safe_file_extension'; -SELECT @option_group_id_mt := max(id) from civicrm_option_group where name = 'mapping_type'; -SELECT @option_group_id_we := max(id) from civicrm_option_group where name = 'wysiwyg_editor'; -SELECT @option_group_id_fu := max(id) from civicrm_option_group where name = 'recur_frequency_units'; -SELECT @option_group_id_pht := max(id) from civicrm_option_group where name = 'phone_type'; -SELECT @option_group_id_fma := max(id) from civicrm_option_group where name = 'from_email_address'; SELECT @option_group_id_cdt := max(id) from civicrm_option_group where name = 'custom_data_type'; SELECT @option_group_id_vis := max(id) from civicrm_option_group where name = 'visibility'; SELECT @option_group_id_mp := max(id) from civicrm_option_group where name = 'mail_protocol'; @@ -271,60 +262,6 @@ VALUES (@option_group_id_report, '{ts escape="sql"}Recurring Contributions Summary{/ts}', 'contribute/recursummary', 'CRM_Report_Form_Contribute_RecurSummary', NULL, 0, 0, 49, '{ts escape="sql"}Provides simple summary for each payment instrument for which there are recurring contributions (e.g. Credit Card, Standing Order, Direct Debit, etc., NULL), showing within a given date range.{/ts}', 0, 0, 1, @contributeCompId, NULL, NULL), (@option_group_id_report, '{ts escape="sql"}Deferred Revenue Details{/ts}', 'contribute/deferredrevenue', 'CRM_Report_Form_Contribute_DeferredRevenue', NULL, 0, 0, 50, '{ts escape="sql"}Deferred Revenue Details Report{/ts}', 0, 0, 1, @contributeCompId, NULL, NULL), - (@option_group_id_cas, '{ts escape="sql"}Ongoing{/ts}' , 1, 'Open' , 'Opened', 0, 1, 1, NULL, 0, 1, 1, NULL, NULL, NULL), - (@option_group_id_cas, '{ts escape="sql"}Resolved{/ts}', 2, 'Closed', 'Closed', 0, 0, 2, NULL, 0, 1, 1, NULL, NULL, NULL), - (@option_group_id_cas, '{ts escape="sql"}Urgent{/ts}' , 3, 'Urgent', 'Opened', 0, 0, 3, NULL, 0, 0, 1, NULL, NULL, NULL), - - (@option_group_id_pl, '{ts escape="sql"}Name Only{/ts}' , 1, 'Name Only' , NULL, 0, 0, 1, 'CRM_Event_Page_ParticipantListing_Name', 0, 1, 1, NULL, NULL, NULL), - (@option_group_id_pl, '{ts escape="sql"}Name and Email{/ts}', 2, 'Name and Email' , NULL, 0, 0, 2, 'CRM_Event_Page_ParticipantListing_NameAndEmail', 0, 1, 1, NULL, NULL, NULL), - (@option_group_id_pl, '{ts escape="sql"}Name, Status and Register Date{/ts}' , 3, 'Name, Status and Register Date', NULL, 0, 0, 3, 'CRM_Event_Page_ParticipantListing_NameStatusAndDate', 0, 1, 1, NULL, NULL, NULL), - - (@option_group_id_sfe, 'jpg', 1, 'jpg', NULL, 0, 0, 1, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_sfe, 'jpeg', 2, 'jpeg', NULL, 0, 0, 2, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_sfe, 'png', 3, 'png', NULL, 0, 0, 3, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_sfe, 'gif', 4, 'gif', NULL, 0, 0, 4, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_sfe, 'txt', 5, 'txt', NULL, 0, 0, 5, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_sfe, 'pdf', 6, 'pdf', NULL, 0, 0, 6, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_sfe, 'doc', 7, 'doc', NULL, 0, 0, 7, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_sfe, 'xls', 8, 'xls', NULL, 0, 0, 8, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_sfe, 'rtf', 9, 'rtf', NULL, 0, 0, 9, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_sfe, 'csv', 10, 'csv', NULL, 0, 0, 10, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_sfe, 'ppt', 11, 'ppt', NULL, 0, 0, 11, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_sfe, 'docx', 12, 'docx', NULL, 0, 0, 12, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_sfe, 'xlsx', 13, 'xlsx', NULL, 0, 0, 13, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_sfe, 'odt', 14, 'odt', NULL, 0, 0, 14, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_sfe, 'ics', 15, 'ics', NULL, 0, 0, 15, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_sfe, 'pptx', 16, 'pptx', NULL, 0, 0, 16, NULL, 0, 0, 1, NULL, NULL, NULL), - - (@option_group_id_we, '{ts escape="sql"}Textarea{/ts}', 1, 'Textarea', NULL, 0, 0, 1, NULL, 0, 1, 1, NULL, NULL, NULL), - (@option_group_id_we, '{ts escape="sql"}CKEditor 4{/ts}', 2, 'CKEditor', NULL, 0, 0, 2, NULL, 0, 1, 1, NULL, NULL, NULL), - - (@option_group_id_mt, '{ts escape="sql"}Search Builder{/ts}', 1, 'Search Builder', NULL, 0, 0, 1, NULL, 0, 1, 1, NULL, NULL, NULL), - (@option_group_id_mt, '{ts escape="sql"}Import Contact{/ts}', 2, 'Import Contact', NULL, 0, 0, 2, NULL, 0, 1, 1, NULL, NULL, NULL), - (@option_group_id_mt, '{ts escape="sql"}Import Activity{/ts}', 3, 'Import Activity', NULL, 0, 0, 3, NULL, 0, 1, 1, NULL, NULL, NULL), - (@option_group_id_mt, '{ts escape="sql"}Import Contribution{/ts}', 4, 'Import Contribution', NULL, 0, 0, 4, NULL, 0, 1, 1, NULL, NULL, NULL), - (@option_group_id_mt, '{ts escape="sql"}Import Membership{/ts}', 5, 'Import Membership', NULL, 0, 0, 5, NULL, 0, 1, 1, NULL, NULL, NULL), - (@option_group_id_mt, '{ts escape="sql"}Import Participant{/ts}', 6, 'Import Participant', NULL, 0, 0, 6, NULL, 0, 1, 1, NULL, NULL, NULL), - (@option_group_id_mt, '{ts escape="sql"}Export Contact{/ts}', 7, 'Export Contact', NULL, 0, 0, 7, NULL, 0, 1, 1, NULL, NULL, NULL), - (@option_group_id_mt, '{ts escape="sql"}Export Contribution{/ts}', 8, 'Export Contribution', NULL, 0, 0, 8, NULL, 0, 1, 1, NULL, NULL, NULL), - (@option_group_id_mt, '{ts escape="sql"}Export Membership{/ts}', 9, 'Export Membership', NULL, 0, 0, 9, NULL, 0, 1, 1, NULL, NULL, NULL), - (@option_group_id_mt, '{ts escape="sql"}Export Participant{/ts}', 10, 'Export Participant', NULL, 0, 0, 10, NULL, 0, 1, 1, NULL, NULL, NULL), - (@option_group_id_mt, '{ts escape="sql"}Export Pledge{/ts}', 11, 'Export Pledge', NULL, 0, 0, 11, NULL, 0, 1, 1, NULL, NULL, NULL), - (@option_group_id_mt, '{ts escape="sql"}Export Case{/ts}', 12, 'Export Case', NULL, 0, 0, 12, NULL, 0, 1, 1, NULL, NULL, NULL), - (@option_group_id_mt, '{ts escape="sql"}Export Activity{/ts}', 14, 'Export Activity', NULL, 0, 0, 14, NULL, 0, 1, 1, NULL, NULL, NULL), - - (@option_group_id_fu, '{ts escape="sql"}day{/ts}' , 'day' , 'day', NULL, 0, 0, 1, NULL, 0, 1, 1, NULL, NULL, NULL), - (@option_group_id_fu, '{ts escape="sql"}week{/ts}' , 'week' , 'week', NULL, 0, 0, 2, NULL, 0, 1, 1, NULL, NULL, NULL), - (@option_group_id_fu, '{ts escape="sql"}month{/ts}' , 'month', 'month', NULL, 0, 0, 3, NULL, 0, 1, 1, NULL, NULL, NULL), - (@option_group_id_fu, '{ts escape="sql"}year{/ts}' , 'year' , 'year', NULL, 0, 0, 4, NULL, 0, 1, 1, NULL, NULL, NULL), - --- phone types. - (@option_group_id_pht, '{ts escape="sql"}Phone{/ts}' , 1, 'Phone' , NULL, 0, 0, 1, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_pht, '{ts escape="sql"}Mobile{/ts}', 2, 'Mobile' , NULL, 0, 0, 2, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_pht, '{ts escape="sql"}Fax{/ts}' , 3, 'Fax' , NULL, 0, 0, 3, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_pht, '{ts escape="sql"}Pager{/ts}' , 4, 'Pager' , NULL, 0, 0, 4, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_pht, '{ts escape="sql"}Voicemail{/ts}' , 5, 'Voicemail' , NULL, 0, 0, 5, NULL, 0, 0, 1, NULL, NULL, NULL), - -- custom data types. (@option_group_id_cdt, '{ts escape="sql"}Participants (Role){/ts}', '1', 'ParticipantRole', 'role_id', 0, 0, 1, NULL, 0, 0, 1, NULL, NULL , NULL), (@option_group_id_cdt, '{ts escape="sql"}Participants (Event Name){/ts}', '2', 'ParticipantEventName', 'event_id', 0, 0, 2, NULL, 0, 0, 1, NULL, NULL , NULL), @@ -733,8 +670,6 @@ VALUES 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`, `domain_id`, `visibility_id`) VALUES --- from email address. - (@option_group_id_fma, '"FIXME" ', '1', '"FIXME" ', NULL, 0, 1, 1, '{ts escape="sql"}Default domain email address and from name.{/ts}', 0, 0, 1, NULL, @domainID, NULL ), -- Mail Approval Status Preferences (@option_group_id_mail_approval_status, '{ts escape="sql"}Approved{/ts}' , 1, 'Approved', NULL, 0, 1, 1, NULL, 0, 1, 1, @mailCompId, @domainID, NULL), -- 2.25.1