From 41aaffbd7855b67b03da69908023845133977f20 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Wed, 17 May 2023 03:56:47 -0700 Subject: [PATCH] Extract communication_style, contact_date_reminder_options, msg_mode, name_badge, wysiwyg_presets --- sql/civicrm_option_groups.php | 21 -------------- .../communication_style.sqldata.php | 9 ++++++ .../contact_date_reminder_options.sqldata.php | 13 +++++++++ .../msg_mode.sqldata.php | 10 +++++++ .../name_badge.sqldata.php | 11 +++++++ .../wysiwyg_presets.sqldata.php | 14 +++++++++ xml/templates/civicrm_data.tpl | 29 ------------------- 7 files changed, 57 insertions(+), 50 deletions(-) create mode 100644 sql/civicrm_option_groups/communication_style.sqldata.php create mode 100644 sql/civicrm_option_groups/contact_date_reminder_options.sqldata.php create mode 100644 sql/civicrm_option_groups/msg_mode.sqldata.php create mode 100644 sql/civicrm_option_groups/name_badge.sqldata.php create mode 100644 sql/civicrm_option_groups/wysiwyg_presets.sqldata.php diff --git a/sql/civicrm_option_groups.php b/sql/civicrm_option_groups.php index 615d01b4a0..410f68d3de 100644 --- a/sql/civicrm_option_groups.php +++ b/sql/civicrm_option_groups.php @@ -19,27 +19,6 @@ $readOptionGroups = function (): array { }; return $readOptionGroups() + [ - 'name_badge' => CRM_Core_CodeGen_OptionGroup::create('name_badge') - ->addMetadata([ - 'title' => ts('Name Badge Format'), - ]), - 'communication_style' => CRM_Core_CodeGen_OptionGroup::create('communication_style') - ->addMetadata([ - 'title' => ts('Communication Style'), - ]), - 'msg_mode' => CRM_Core_CodeGen_OptionGroup::create('msg_mode') - ->addMetadata([ - 'title' => ts('Message Mode'), - ]), - 'contact_date_reminder_options' => CRM_Core_CodeGen_OptionGroup::create('contact_date_reminder_options') - ->addMetadata([ - 'title' => ts('Contact Date Reminder Options'), - 'is_locked' => '1', - ]), - 'wysiwyg_presets' => CRM_Core_CodeGen_OptionGroup::create('wysiwyg_presets') - ->addMetadata([ - 'title' => ts('WYSIWYG Editor Presets'), - ]), 'relative_date_filters' => CRM_Core_CodeGen_OptionGroup::create('relative_date_filters') ->addMetadata([ 'title' => ts('Relative Date Filters'), diff --git a/sql/civicrm_option_groups/communication_style.sqldata.php b/sql/civicrm_option_groups/communication_style.sqldata.php new file mode 100644 index 0000000000..518a80b96e --- /dev/null +++ b/sql/civicrm_option_groups/communication_style.sqldata.php @@ -0,0 +1,9 @@ +addMetadata([ + 'title' => ts('Communication Style'), + ]) + ->addValues(['label', 'name', 'value'], [ + [ts('Formal'), 'formal', 1, 'is_default' => 1], + [ts('Familiar'), 'familiar', 2], + ]); diff --git a/sql/civicrm_option_groups/contact_date_reminder_options.sqldata.php b/sql/civicrm_option_groups/contact_date_reminder_options.sqldata.php new file mode 100644 index 0000000000..91596a4f39 --- /dev/null +++ b/sql/civicrm_option_groups/contact_date_reminder_options.sqldata.php @@ -0,0 +1,13 @@ +addMetadata([ + 'title' => ts('Contact Date Reminder Options'), + 'is_locked' => 1, + ]) + ->addValues(['label', 'name', 'value'], [ + [ts('Actual date only'), 'Actual date only', 1, 'is_reserved' => 1], + [ts('Each anniversary'), 'Each anniversary', 2, 'is_reserved' => 1], + ]) + ->addDefaults([ + 'filter' => NULL, + ]); diff --git a/sql/civicrm_option_groups/msg_mode.sqldata.php b/sql/civicrm_option_groups/msg_mode.sqldata.php new file mode 100644 index 0000000000..1b9ebcf773 --- /dev/null +++ b/sql/civicrm_option_groups/msg_mode.sqldata.php @@ -0,0 +1,10 @@ +addMetadata([ + 'title' => ts('Message Mode'), + ]) + ->addValues(['label', 'name', 'value'], [ + [ts('Email'), 'Email', 'Email', 'is_default' => 1, 'is_reserved' => 1], + [ts('SMS'), 'SMS', 'SMS', 'is_reserved' => 1], + [ts('User Preference'), 'User Preference', 'User_Preference', 'is_reserved' => 1], + ]); diff --git a/sql/civicrm_option_groups/name_badge.sqldata.php b/sql/civicrm_option_groups/name_badge.sqldata.php new file mode 100644 index 0000000000..a1abcdbf54 --- /dev/null +++ b/sql/civicrm_option_groups/name_badge.sqldata.php @@ -0,0 +1,11 @@ +addMetadata([ + 'title' => ts('Name Badge Format'), + ]) + ->addValues(['label', 'name', 'value'], [ + [ts('Avery 5395'), 'Avery 5395', '{"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}'], + [ts('A6 Badge Portrait 150x106'), 'A6 Badge Portrait 150x106', '{"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}'], + [ts('Fattorini Name Badge 100x65'), 'Fattorini Name Badge 100x65', '{"paper-size":"a4","orientation":"portrait","font-name":"times","font-size":6,"font-style":"","NX":2,"NY":4,"metric":"mm","lMargin":6,"tMargin":19,"SpaceX":0,"SpaceY":0,"width":100,"height":65,"lPadding":0,"tPadding":0}'], + [ts('Hanging Badge 3-3/4" x 4-3"/4'), 'Hanging Badge 3-3/4" x 4-3"/4', '{"paper-size":"a4","orientation":"portrait","font-name":"times","font-size":6,"font-style":"","NX":2,"NY":2,"metric":"mm","lMargin":10,"tMargin":28,"SpaceX":0,"SpaceY":0,"width":96,"height":121,"lPadding":5,"tPadding":5}'], + ]); diff --git a/sql/civicrm_option_groups/wysiwyg_presets.sqldata.php b/sql/civicrm_option_groups/wysiwyg_presets.sqldata.php new file mode 100644 index 0000000000..0fcf34b0cf --- /dev/null +++ b/sql/civicrm_option_groups/wysiwyg_presets.sqldata.php @@ -0,0 +1,14 @@ +addMetadata([ + 'title' => ts('WYSIWYG Editor Presets'), + ]) + ->addValues(['label', 'name', 'value'], [ + [ts('Default'), 'default', 1, 'is_default' => 1], + [ts('CiviMail'), 'civimail', 2, 'component_id' => 4], + [ts('CiviEvent'), 'civievent', 3, 'component_id' => 1], + ]) + ->addDefaults([ + 'filter' => NULL, + 'is_reserved' => 1, + ]); diff --git a/xml/templates/civicrm_data.tpl b/xml/templates/civicrm_data.tpl index e83886ae79..7085323575 100644 --- a/xml/templates/civicrm_data.tpl +++ b/xml/templates/civicrm_data.tpl @@ -136,12 +136,7 @@ SELECT @option_group_id_pi := max(id) from civicrm_option_group wher SELECT @option_group_id_arel := max(id) from civicrm_option_group where name = 'account_relationship'; SELECT @option_group_id_fat := max(id) from civicrm_option_group where name = 'financial_account_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'; -SELECT @option_group_id_contactDateMode := max(id) from civicrm_option_group where name = 'contact_date_reminder_options'; SELECT @option_group_id_date_filter := max(id) from civicrm_option_group where name = 'relative_date_filters'; -SELECT @option_group_id_wysiwyg_presets := max(id) from civicrm_option_group where name = 'wysiwyg_presets'; SELECT @option_group_id_ps := max(id) from civicrm_option_group where name = 'pledge_status'; SELECT @option_group_id_crs := max(id) from civicrm_option_group where name = 'contribution_recur_status'; SELECT @option_group_id_env := max(id) from civicrm_option_group where name = 'environment'; @@ -160,30 +155,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 --- 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), - (@option_group_id_name_badge, '{ts escape="sql"}Fattorini Name Badge 100x65{/ts}', '{literal}{"paper-size":"a4","orientation":"portrait","font-name":"times","font-size":6,"font-style":"","NX":2,"NY":4,"metric":"mm","lMargin":6,"tMargin":19,"SpaceX":0,"SpaceY":0,"width":100,"height":65,"lPadding":0,"tPadding":0}{/literal}', 'Fattorini Name Badge 100x65', NULL, 0, 0, 3, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_name_badge, '{ts escape="sql"}Hanging Badge 3-3/4" x 4-3"/4{/ts}', '{literal}{"paper-size":"a4","orientation":"portrait","font-name":"times","font-size":6,"font-style":"","NX":2,"NY":2,"metric":"mm","lMargin":10,"tMargin":28,"SpaceX":0,"SpaceY":0,"width":96,"height":121,"lPadding":5,"tPadding":5}{/literal}', 'Hanging Badge 3-3/4" x 4-3"/4', NULL, 0, 0, 4, NULL, 0, 0, 1, NULL, NULL, NULL), - --- Communication Styles - (@option_group_id_communication_style, '{ts escape="sql"}Formal{/ts}' , 1, 'formal' , NULL, 0, 1, 1, NULL, 0, 0, 1, NULL, NULL, NULL), - (@option_group_id_communication_style, '{ts escape="sql"}Familiar{/ts}', 2, 'familiar', NULL, 0, 0, 2, NULL, 0, 0, 1, NULL, NULL, NULL), - --- Message Mode -(@option_group_id_msg_mode, '{ts escape="sql"}Email{/ts}', 'Email', 'Email', NULL, 0, 1, 1, NULL, 0, 1, 1, NULL, NULL, NULL), -(@option_group_id_msg_mode, '{ts escape="sql"}SMS{/ts}', 'SMS', 'SMS', NULL, 0, 0, 2, NULL, 0, 1, 1, NULL, NULL, NULL), -(@option_group_id_msg_mode, '{ts escape="sql"}User Preference{/ts}', 'User_Preference', 'User Preference', NULL, 0, 0, 3, NULL, 0, 1, 1, NULL, NULL, NULL), - --- Reminder Options for Contact Date Fields -(@option_group_id_contactDateMode, '{ts escape="sql"}Actual date only{/ts}', '1', 'Actual date only', NULL, NULL, 0, 1, NULL, 0, 1, 1, NULL, NULL, NULL), -(@option_group_id_contactDateMode, '{ts escape="sql"}Each anniversary{/ts}', '2', 'Each anniversary', NULL, NULL, 0, 2, NULL, 0, 1, 1, NULL, NULL, NULL), - --- WYSIWYG Editor Presets -(@option_group_id_wysiwyg_presets, '{ts escape="sql"}Default{/ts}', '1', 'default', NULL, NULL, 1, 1, NULL, 0, 1, 1, NULL, NULL, NULL), -(@option_group_id_wysiwyg_presets, '{ts escape="sql"}CiviMail{/ts}', '2', 'civimail', NULL, NULL, 0, 2, NULL, 0, 1, 1, @mailCompId, NULL, NULL), -(@option_group_id_wysiwyg_presets, '{ts escape="sql"}CiviEvent{/ts}', '3', 'civievent', NULL, NULL, 0, 3, NULL, 0, 1, 1, @eventCompId, NULL, NULL), - -- Environment (@option_group_id_env, '{ts escape="sql"}Production{/ts}', 'Production', 'Production', NULL, NULL, 1, 1, 'Production Environment', 0, 1, 1, NULL, NULL, NULL), (@option_group_id_env, '{ts escape="sql"}Staging{/ts}', 'Staging', 'Staging', NULL, NULL, 0, 2, 'Staging Environment', 0, 1, 1, NULL, NULL, NULL), -- 2.25.1