From 5b5217d75b850748f19707387b65806831acf670 Mon Sep 17 00:00:00 2001 From: Olaf Buddenhagen Date: Mon, 5 Aug 2013 14:28:32 +0200 Subject: [PATCH] Make `formal_title` field optional Add a config setting to make display of the Title input field (in contact edit forms) optional. (This doesn't affect contact view, as the name displayed there is determined by the "Individual Display Name Format" template instead.) This is a minimal approach, adding just the title setting. Perhaps it might be preferable to add a full set of options for disabling the other name fields as well, while at it?... (We are willing to do that too, as it shouldn't be too hard, and we have users for that as well -- but we need some consensus about the right way for handling this.) The setting is placed in the "Display Preferences", next to the "Individual Display Name Format". However, it could be placed next to "Editing Contacts" (also in "Display Preferences") as well -- it's somewhat related to both... --- CRM/Admin/Form/Preferences/Display.php | 5 +++++ CRM/Contact/Form/Edit/Individual.php | 4 +++- settings/Core.setting.php | 14 ++++++++++++++ templates/CRM/Admin/Form/Preferences/Display.tpl | 10 ++++++++++ 4 files changed, 32 insertions(+), 1 deletion(-) diff --git a/CRM/Admin/Form/Preferences/Display.php b/CRM/Admin/Form/Preferences/Display.php index 6ec0ead111..f09f7db50d 100644 --- a/CRM/Admin/Form/Preferences/Display.php +++ b/CRM/Admin/Form/Preferences/Display.php @@ -104,6 +104,11 @@ class CRM_Admin_Form_Preferences_Display extends CRM_Admin_Form_Preferences { 'html_type' => NULL, 'weight' => 11, ), + 'formal_title' => array( + 'html_type' => 'checkbox', + 'title' => ts('Use Formal Title Field'), + 'weight' => 12, + ), ), ); diff --git a/CRM/Contact/Form/Edit/Individual.php b/CRM/Contact/Form/Edit/Individual.php index d87f7dddc4..45a4e78f1d 100644 --- a/CRM/Contact/Form/Edit/Individual.php +++ b/CRM/Contact/Form/Edit/Individual.php @@ -63,7 +63,9 @@ class CRM_Contact_Form_Edit_Individual { $attributes = CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact'); - $form->addElement('text', 'formal_title', ts('Title'), $attributes['formal_title']); + if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'formal_title')) { + $form->addElement('text', 'formal_title', ts('Title'), $attributes['formal_title']); + } // first_name $form->addElement('text', 'first_name', ts('First Name'), $attributes['first_name']); diff --git a/settings/Core.setting.php b/settings/Core.setting.php index 6aa61302ce..8826e5481a 100644 --- a/settings/Core.setting.php +++ b/settings/Core.setting.php @@ -250,6 +250,20 @@ return array ( 'description' => null, 'help_text' => null, ), + 'formal_title' => array( + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'formal_title', + 'type' => 'Boolean', + 'quick_form_type' => 'YesNo', + 'default' => 0, + 'add' => '4.4', + 'title' => 'Use Formal Title Field', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'Enables display of the Formal Title field in the name edit block for individuals.', + 'help_text' => null, + ), 'contact_reference_options' => array( 'group_name' => 'CiviCRM Preferences', 'group' => 'core', diff --git a/templates/CRM/Admin/Form/Preferences/Display.tpl b/templates/CRM/Admin/Form/Preferences/Display.tpl index 3f0e6e7e5d..d2336f5a41 100644 --- a/templates/CRM/Admin/Form/Preferences/Display.tpl +++ b/templates/CRM/Admin/Form/Preferences/Display.tpl @@ -184,6 +184,16 @@ fields).{/ts} {help id="id-editor_id"} + + {$form.formal_title.label} + {$form.formal_title.html} + + +   + + {ts}Enables display of the Formal Title field in the name edit block for individuals.{/ts} + + {$form.display_name_format.label} {$form.display_name_format.html} -- 2.25.1