$contactBlocks = CRM_Core_OptionGroup::values('contact_edit_options', FALSE, FALSE, FALSE, 'AND v.filter = 1');
$this->assign('contactBlocks', $contactBlocks);
+ $nameFields = CRM_Core_OptionGroup::values('contact_edit_options', FALSE, FALSE, FALSE, 'AND v.filter = 2');
+ $this->assign('nameFields', $nameFields);
+
$this->addElement('hidden', 'contact_edit_preferences', NULL, array('id' => 'contact_edit_preferences'));
parent::buildQuickForm();
$form->applyFilter('__ALL__', 'trim');
if ( !$inlineEditMode || $inlineEditMode == 1 ) {
+ $nameFields = CRM_Core_BAO_Setting::valueOptions(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
+ 'contact_edit_options', TRUE, NULL,
+ FALSE, 'name', TRUE, 'AND v.filter = 2'
+ );
+
//prefix
$prefix = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'prefix_id');
- if (!empty($prefix)) {
+ if (isset($nameFields['Prefix']) && !empty($prefix)) {
$form->addElement('select', 'prefix_id', ts('Prefix'), array('' => '') + $prefix);
}
$attributes = CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact');
- $form->addElement('text', 'formal_title', ts('Title'), $attributes['formal_title']);
+ if (isset($nameFields['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']);
+ if (isset($nameFields['First Name'])) {
+ $form->addElement('text', 'first_name', ts('First Name'), $attributes['first_name']);
+ }
//middle_name
- $form->addElement('text', 'middle_name', ts('Middle Name'), $attributes['middle_name']);
+ if (isset($nameFields['Middle Name'])) {
+ $form->addElement('text', 'middle_name', ts('Middle Name'), $attributes['middle_name']);
+ }
// last_name
- $form->addElement('text', 'last_name', ts('Last Name'), $attributes['last_name']);
+ if (isset($nameFields['Last Name'])) {
+ $form->addElement('text', 'last_name', ts('Last Name'), $attributes['last_name']);
+ }
// suffix
$suffix = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'suffix_id');
- if ($suffix) {
+ if (isset($nameFields['Suffix']) && $suffix) {
$form->addElement('select', 'suffix_id', ts('Suffix'), array('' => '') + $suffix);
}
}
// task to process sql
$this->addTask(ts('Upgrade DB to 4.5.alpha1: SQL'), 'task_4_5_x_runSql', $rev);
+ $this->addTask(ts('Set default for Individual name fields configuration'), 'addNameFieldOptions');
+
+ return TRUE;
+ }
+
+ /**
+ * Add defaults for the newly introduced name fields configuration in 'contact_edit_options' setting
+ *
+ * @return bool TRUE for success
+ */
+ static function addNameFieldOptions(CRM_Queue_TaskContext $ctx) {
+ $query = "SELECT `value` FROM `civicrm_setting` WHERE `group_name` = 'CiviCRM Preferences' AND `name` = 'contact_edit_options'";
+ $dao = CRM_Core_DAO::executeQuery($query);
+ $dao->fetch();
+ $oldValue = unserialize($dao->value);
+
+ $newValue = $oldValue . '12\ 114\ 115\ 116\ 117\ 1';
+
+ $query = "UPDATE `civicrm_setting` SET `value` = %1 WHERE `group_name` = 'CiviCRM Preferences' AND `name` = 'contact_edit_options'";
+ $params = array(1 => array(serialize($newValue), 'String'));
+ CRM_Core_DAO::executeQuery($query, $params);
+
return TRUE;
}
( {$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 );
-- CRM-9988 Change world region of Panama country to America South, Central, North and Caribbean
-UPDATE `civicrm_country` SET `region_id` = 2 WHERE `id` = 1166;
\ No newline at end of file
+UPDATE `civicrm_country` SET `region_id` = 2 WHERE `id` = 1166;
+
+SELECT @option_group_id_contact_edit_options := max(id) from civicrm_option_group where name = 'contact_edit_options';
+
+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`)
+VALUES
+ (@option_group_id_contact_edit_options, {localize}'{ts escape="sql"}Prefix{/ts}'{/localize} , 12, 'Prefix' , NULL, 2, NULL, 12, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_contact_edit_options, {localize}'{ts escape="sql"}Formal Title{/ts}'{/localize}, 13, 'Formal Title', NULL, 2, NULL, 13, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_contact_edit_options, {localize}'{ts escape="sql"}First Name{/ts}'{/localize} , 14, 'First Name' , NULL, 2, NULL, 14, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_contact_edit_options, {localize}'{ts escape="sql"}Middle Name{/ts}'{/localize} , 15, 'Middle Name' , NULL, 2, NULL, 15, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_contact_edit_options, {localize}'{ts escape="sql"}Last Name{/ts}'{/localize} , 16, 'Last Name' , NULL, 2, NULL, 16, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_contact_edit_options, {localize}'{ts escape="sql"}Suffix{/ts}'{/localize} , 17, 'Suffix' , NULL, 2, NULL, 17, NULL, 0, 0, 1, NULL, NULL);
<tr class="crm-preferences-display-form-block-contact_edit_options">
<td class="label">{$form.contact_edit_options.label}</td>
<td>
- <table style="width:80%">
+ <table style="width:90%">
<tr>
- <td style="width:40%">
+ <td style="width:30%">
+ <span class="label"><strong>{ts}Individual Name Fields{/ts}</strong></span>
+ <ul id="contactEditNameFields">
+ {foreach from=$nameFields item="title" key="opId"}
+ <li id="preference-{$opId}-contactedit" class="ui-state-default ui-corner-all"
+ style="padding-left:1px;">
+ <span>{$form.contact_edit_options.$opId.html}</span>
+ </li>
+ {/foreach}
+ </ul>
+ </td>
+ <td style="width:30%">
<span class="label"><strong>{ts}Contact Details{/ts}</strong></span>
<ul id="contactEditBlocks">
{foreach from=$contactBlocks item="title" key="opId"}
{$form.formal_title.html}
</td>
{/if}
+ {if $form.first_name}
<td>
{$form.first_name.label}<br />
{$form.first_name.html}
</td>
+ {/if}
+ {if $form.middle_name}
<td>
{$form.middle_name.label}<br />
{$form.middle_name.html}
</td>
+ {/if}
+ {if $form.last_name}
<td>
{$form.last_name.label}<br />
{$form.last_name.html}
</td>
+ {/if}
{if $form.suffix_id}
<td>
{$form.suffix_id.label}<br/>
{$form.formal_title.html}
</div>
{/if}
- <div class="crm-inline-edit-field">
- {$form.first_name.label}<br />
- {$form.first_name.html}
- </div>
- <div class="crm-inline-edit-field">
- {$form.middle_name.label}<br />
- {$form.middle_name.html}
- </div>
- <div class="crm-inline-edit-field">
- {$form.last_name.label}<br />
- {$form.last_name.html}
- </div>
+ {if $form.first_name}
+ <div class="crm-inline-edit-field">
+ {$form.first_name.label}<br />
+ {$form.first_name.html}
+ </div>
+ {/if}
+ {if $form.middle_name}
+ <div class="crm-inline-edit-field">
+ {$form.middle_name.label}<br />
+ {$form.middle_name.html}
+ </div>
+ {/if}
+ {if $form.last_name}
+ <div class="crm-inline-edit-field">
+ {$form.last_name.label}<br />
+ {$form.last_name.html}
+ </div>
+ {/if}
{if $form.suffix_id}
<div class="crm-inline-edit-field">
{$form.suffix_id.label}<br/>
(@option_group_id_ceOpt, '{ts escape="sql"}Instant Messenger{/ts}' , 9, 'IM', NULL, 1, NULL, 9, NULL, 0, 0, 1, NULL, NULL),
(@option_group_id_ceOpt, '{ts escape="sql"}Open ID{/ts}' , 10, 'OpenID', NULL, 1, NULL, 10, NULL, 0, 0, 1, NULL, NULL),
(@option_group_id_ceOpt, '{ts escape="sql"}Website{/ts}' , 11, 'Website', NULL, 1, NULL, 11, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_ceOpt, '{ts escape="sql"}Prefix{/ts}' , 12, 'Prefix', NULL, 2, NULL, 12, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_ceOpt, '{ts escape="sql"}Formal Title{/ts}' , 13, 'Formal Title', NULL, 2, NULL, 13, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_ceOpt, '{ts escape="sql"}First Name{/ts}' , 14, 'First Name', NULL, 2, NULL, 14, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_ceOpt, '{ts escape="sql"}Middle Name{/ts}' , 15, 'Middle Name', NULL, 2, NULL, 15, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_ceOpt, '{ts escape="sql"}Last Name{/ts}' , 16, 'Last Name', NULL, 2, NULL, 16, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_ceOpt, '{ts escape="sql"}Suffix{/ts}' , 17, 'Suffix', NULL, 2, NULL, 17, NULL, 0, 0, 1, NULL, NULL),
(@option_group_id_asOpt, '{ts escape="sql"}Address Fields{/ts}' , 1, 'location', NULL, 0, NULL, 1, NULL, 0, 0, 1, NULL, NULL),
(@option_group_id_asOpt, '{ts escape="sql"}Custom Fields{/ts}' , 2, 'custom', NULL, 0, NULL, 2, NULL, 0, 0, 1, NULL, NULL),
VALUES
( @domainID, NULL, 1, 'CiviCRM Preferences', 'contact_view_options', '{serialize}\ 11\ 12\ 13\ 14\ 15\ 16\ 17\ 18\ 19\ 110\ 111\ 113\ 1{/serialize}' ),
( @domainID, NULL, 1, 'CiviCRM Preferences', 'contact_smart_group_display', '{serialize}1{/serialize}' ),
- ( @domainID, NULL, 1, 'CiviCRM Preferences', 'contact_edit_options', '{serialize}\ 11\ 12\ 13\ 14\ 15\ 16\ 17\ 18\ 19\ 111\ 1{/serialize}' ),
+ ( @domainID, NULL, 1, 'CiviCRM Preferences', 'contact_edit_options', '{serialize}\ 11\ 12\ 13\ 14\ 15\ 16\ 17\ 18\ 19\ 111\ 112\ 114\ 115\ 116\ 117\ 1{/serialize}' ),
( @domainID, NULL, 1, 'CiviCRM Preferences', 'advanced_search_options', '{serialize}\ 11\ 12\ 13\ 14\ 15\ 16\ 17\ 18\ 19\ 110\ 111\ 112\ 113\ 115\ 116\ 117\ 118\ 119\ 1{/serialize}' ),
( @domainID, NULL, 1, 'CiviCRM Preferences', 'user_dashboard_options', '{serialize}\ 11\ 12\ 13\ 14\ 15\ 17\ 18\ 1{/serialize}' ),
( @domainID, NULL, 1, 'CiviCRM Preferences', 'address_options', '{serialize}\ 11\ 12\ 13\ 14\ 15\ 16\ 18\ 19\ 110\ 111\ 1{/serialize}' ),