From d4311a7abfb0378b5df34fac5cd6ab082e16b8e3 Mon Sep 17 00:00:00 2001 From: Olaf Buddenhagen Date: Wed, 14 Aug 2013 00:30:42 +0200 Subject: [PATCH] Add configuration UI for Communication Style options Add a page in the Communication Preferences, using the generic Option handler. The menu entry is added above the entries for Email Greeting Formats, Postal Greeting Formats, and Addressee Formats, just like in the actual contact forms and views. --- CRM/Admin/Form/Options.php | 2 +- CRM/Admin/Page/Options.php | 1 + CRM/Core/xml/Menu/Admin.xml | 10 ++++++++++ CRM/Upgrade/Incremental/sql/4.5.alpha1.mysql.tpl | 15 +++++++++++++++ xml/templates/civicrm_navigation.tpl | 7 ++++--- 5 files changed, 31 insertions(+), 4 deletions(-) diff --git a/CRM/Admin/Form/Options.php b/CRM/Admin/Form/Options.php index 66dae58245..50f413e46f 100644 --- a/CRM/Admin/Form/Options.php +++ b/CRM/Admin/Form/Options.php @@ -271,7 +271,7 @@ class CRM_Admin_Form_Options extends CRM_Admin_Form { //fix for CRM-3552, CRM-4575 if (in_array($this->_gName, array( - 'email_greeting', 'postal_greeting', 'addressee', 'from_email_address', 'case_status', 'encounter_medium', 'case_type'))) { + 'communication_style', 'email_greeting', 'postal_greeting', 'addressee', 'from_email_address', 'case_status', 'encounter_medium', 'case_type'))) { $this->assign('showDefault', TRUE); $this->add('checkbox', 'is_default', ts('Default Option?')); } diff --git a/CRM/Admin/Page/Options.php b/CRM/Admin/Page/Options.php index 14407a7207..74395c8d50 100644 --- a/CRM/Admin/Page/Options.php +++ b/CRM/Admin/Page/Options.php @@ -116,6 +116,7 @@ class CRM_Admin_Page_Options extends CRM_Core_Page_Basic { array( 'from_email_address', 'email_greeting', 'postal_greeting', 'addressee', + 'communication_style', 'case_status', 'encounter_medium', 'case_type', ) diff --git a/CRM/Core/xml/Menu/Admin.xml b/CRM/Core/xml/Menu/Admin.xml index ecbafb53a8..f56b9d8302 100644 --- a/CRM/Core/xml/Menu/Admin.xml +++ b/CRM/Core/xml/Menu/Admin.xml @@ -330,6 +330,16 @@ admin/small/template.png 70 + + civicrm/admin/options/communication_style + Communication Style Options + Options for Communication Style selection. + group=communication_style + CRM_Admin_Page_Options + Communications + admin/small/01.png + 75 + civicrm/admin/options/email_greeting Email Greeting Formats diff --git a/CRM/Upgrade/Incremental/sql/4.5.alpha1.mysql.tpl b/CRM/Upgrade/Incremental/sql/4.5.alpha1.mysql.tpl index 3a0a94bf45..1d2b2a2798 100644 --- a/CRM/Upgrade/Incremental/sql/4.5.alpha1.mysql.tpl +++ b/CRM/Upgrade/Incremental/sql/4.5.alpha1.mysql.tpl @@ -19,3 +19,18 @@ INSERT INTO VALUES (@option_group_id_communication_style, {localize}'{ts escape="sql"}Formal{/ts}'{/localize} , 1, 'formal' , NULL, 0, 1, 1, NULL, 0, 0, 1, NULL, NULL), (@option_group_id_communication_style, {localize}'{ts escape="sql"}Familiar{/ts}'{/localize}, 2, 'familiar', NULL, 0, 0, 2, NULL, 0, 0, 1, NULL, NULL); + +-- Insert menu item at Administer > Communications, above the various Greeting Formats + +SELECT @parent_id := `id` FROM `civicrm_navigation` WHERE `name` = 'Communications' AND `domain_id` = {$domainID}; +SELECT @add_weight := MIN(`weight`) FROM `civicrm_navigation` WHERE `name` IN('Email Greeting Formats', 'Postal Greeting Formats', 'Addressee Formats') AND `parent_id` = @parent_id; + +UPDATE `civicrm_navigation` +SET `weight` = `weight`+1 +WHERE `parent_id` = @parent_id +AND `weight` >= @add_weight; + +INSERT INTO `civicrm_navigation` + ( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight ) +VALUES + ( {$domainID}, 'civicrm/admin/options/communication_style&group=communication_style&reset=1', '{ts escape="sql" skip="true"}Communication Style Options{/ts}', 'Communication Style Options', 'administer CiviCRM', '', @parent_id, '1', NULL, @add_weight ); diff --git a/xml/templates/civicrm_navigation.tpl b/xml/templates/civicrm_navigation.tpl index c77bd53fe9..8c9424a9f0 100644 --- a/xml/templates/civicrm_navigation.tpl +++ b/xml/templates/civicrm_navigation.tpl @@ -406,9 +406,10 @@ VALUES ( @domainID, 'civicrm/admin/options/preferred_communication_method&group=preferred_communication_method&reset=1', '{ts escape="sql" skip="true"}Preferred Communication Methods{/ts}', 'Preferred Communication Methods', 'administer CiviCRM', '', @communicationslastID, '1', NULL, 5 ), ( @domainID, 'civicrm/admin/labelFormats&reset=1', '{ts escape="sql" skip="true"}Label Formats{/ts}', 'Label Formats', 'administer CiviCRM', '', @communicationslastID, '1', NULL, 6 ), ( @domainID, 'civicrm/admin/pdfFormats&reset=1', '{ts escape="sql" skip="true"}Print Page (PDF) Formats{/ts}', 'Print Page (PDF) Formats', 'administer CiviCRM', '', @communicationslastID, '1', NULL, 7 ), - ( @domainID, 'civicrm/admin/options/email_greeting&group=email_greeting&reset=1', '{ts escape="sql" skip="true"}Email Greeting Formats{/ts}', 'Email Greeting Formats', 'administer CiviCRM', '', @communicationslastID, '1', NULL, 8 ), - ( @domainID, 'civicrm/admin/options/postal_greeting&group=postal_greeting&reset=1', '{ts escape="sql" skip="true"}Postal Greeting Formats{/ts}', 'Postal Greeting Formats', 'administer CiviCRM', '', @communicationslastID, '1', NULL, 9 ), - ( @domainID, 'civicrm/admin/options/addressee&group=addressee&reset=1', '{ts escape="sql" skip="true"}Addressee Formats{/ts}', 'Addressee Formats', 'administer CiviCRM', '', @communicationslastID, '1', NULL, 10 ); + ( @domainID, 'civicrm/admin/options/communication_style&group=communication_style&reset=1', '{ts escape="sql" skip="true"}Communication Style Options{/ts}', 'Communication Style Options', 'administer CiviCRM', '', @communicationslastID, '1', NULL, 8 ), + ( @domainID, 'civicrm/admin/options/email_greeting&group=email_greeting&reset=1', '{ts escape="sql" skip="true"}Email Greeting Formats{/ts}', 'Email Greeting Formats', 'administer CiviCRM', '', @communicationslastID, '1', NULL, 9 ), + ( @domainID, 'civicrm/admin/options/postal_greeting&group=postal_greeting&reset=1', '{ts escape="sql" skip="true"}Postal Greeting Formats{/ts}', 'Postal Greeting Formats', 'administer CiviCRM', '', @communicationslastID, '1', NULL, 10 ), + ( @domainID, 'civicrm/admin/options/addressee&group=addressee&reset=1', '{ts escape="sql" skip="true"}Addressee Formats{/ts}', 'Addressee Formats', 'administer CiviCRM', '', @communicationslastID, '1', NULL, 11 ); INSERT INTO civicrm_navigation ( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight ) -- 2.25.1