Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert final settings on the Display form #13040

Merged
merged 1 commit into from
Oct 31, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 4 additions & 57 deletions CRM/Admin/Form/Preferences/Display.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,80 +39,32 @@ class CRM_Admin_Form_Preferences_Display extends CRM_Admin_Form_Preferences {
protected $_settings = array(
'contact_view_options' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'contact_smart_group_display' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'contact_edit_options' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'advanced_search_options' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'user_dashboard_options' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'contact_ajax_check_similar' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'activity_assignee_notification' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'activity_assignee_notification_ics' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'do_not_notify_assignees_for' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'preserve_activity_tab_filter' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'editor_id' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'ajaxPopupsEnabled' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'display_name_format' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'sort_name_format' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
);

public function preProcess() {
CRM_Utils_System::setTitle(ts('Settings - Display Preferences'));
$optionValues = CRM_Activity_BAO_Activity::buildOptions('activity_type_id');

$this->_varNames = array(
CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME => array(
'contact_edit_options' => array(
'html_type' => 'checkboxes',
'title' => ts('Editing Contacts'),
'weight' => 3,
),
'contact_ajax_check_similar' => array(
'title' => ts('Check for Similar Contacts'),
'weight' => 8,
'html_type' => NULL,
),
'editor_id' => array(
'html_type' => NULL,
'weight' => 12,
),
'do_not_notify_assignees_for' => array(
'html_type' => 'select',
'option_values' => $optionValues,
'attributes' => array('multiple' => 1, "class" => "huge crm-select2"),
'title' => ts('Do not notify assignees for'),
'weight' => 14,
),
),
);

parent::preProcess();
}

/**
* @return array
*/
public function setDefaultValues() {
$defaults = parent::setDefaultValues();
parent::cbsDefaultValues($defaults);

return $defaults;
}

/**
* Build the form object.
*/
public function buildQuickForm() {
$wysiwyg_options = CRM_Core_OptionGroup::values('wysiwyg_editor', FALSE, FALSE, FALSE, NULL, 'label', TRUE, FALSE, 'name');

//changes for freezing the invoices/credit notes checkbox if invoicing is uncheck
$invoiceSettings = Civi::settings()->get('contribution_invoice_settings');
$invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings);
$this->assign('invoicing', $invoicing);
$extra = array();

$this->addElement('select', 'editor_id', ts('WYSIWYG Editor'), $wysiwyg_options, $extra);
$this->addElement('submit', 'ckeditor_config', ts('Configure CKEditor'));

$this->addRadio('contact_ajax_check_similar', ts('Check for Similar Contacts'), array(
'1' => ts('While Typing'),
'0' => ts('When Saving'),
'2' => ts('Never'),
));

$editOptions = CRM_Core_OptionGroup::values('contact_edit_options', FALSE, FALSE, FALSE, 'AND v.filter = 0');
$this->assign('editOptions', $editOptions);

Expand Down Expand Up @@ -151,13 +103,8 @@ public function postProcess() {
CRM_Core_BAO_OptionValue::updateOptionWeights($opGroupId, array_flip($preferenceWeights));
}

$this->_config->editor_id = $this->_params['editor_id'];

$this->postProcessCommon();

// Fixme - shouldn't be needed
Civi::settings()->set('contact_ajax_check_similar', $this->_params['contact_ajax_check_similar']);

// If "Configure CKEditor" button was clicked
if (!empty($this->_params['ckeditor_config'])) {
// Suppress the "Saved" status message and redirect to the CKEditor Config page
Expand Down
2 changes: 1 addition & 1 deletion CRM/Admin/Form/SettingTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ protected function addFieldsDefinedInSettingsMetadata() {
foreach ($settingMetaData as $setting => $props) {
$quickFormType = $this->getQuickFormType($props);
if (isset($quickFormType)) {
$options = NULL;
$options = CRM_Utils_Array::value('options', $props);
if (isset($props['pseudoconstant'])) {
$options = civicrm_api3('Setting', 'getoptions', [
'field' => $setting,
Expand Down
12 changes: 8 additions & 4 deletions settings/Core.setting.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,13 @@
'group' => 'core',
'name' => 'editor_id',
'type' => 'String',
'html_type' => 'Select',
'html_type' => 'select',
'default' => 'CKEditor',
'add' => '4.1',
'title' => ts('Wysiwig Editor'),
'pseudoconstant' => array(
'optionGroupName' => 'wysiwyg_editor',
),
'is_domain' => 1,
'is_contact' => 0,
'description' => NULL,
Expand All @@ -236,6 +239,7 @@
'is_contact' => 0,
'description' => NULL,
'help_text' => NULL,
'options' => ['1' => ts('While Typing'), '0' => ts('When Saving'), '2' => ts('Never')],
),
'ajaxPopupsEnabled' => array(
'group_name' => 'CiviCRM Preferences',
Expand Down Expand Up @@ -996,9 +1000,9 @@
'is_domain' => 1,
'is_contact' => 0,
'default' => array(),
'title' => 'Do not notify assignees for',
'help_text' => 'These activity types will be excluded from automated email notifications to assignees.',
'html_type' => 'Select',
'title' => ts('Do not notify assignees for'),
'description' => ts('These activity types will be excluded from automated email notifications to assignees.'),
'html_type' => 'select',
'html_attributes' => array(
'multiple' => 1,
'class' => 'huge crm-select2',
Expand Down
8 changes: 4 additions & 4 deletions templates/CRM/Admin/Form/Preferences/Display.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
</tr>
<tr class="crm-preferences-display-form-block-activity_assignee_notification">
<td class="label"></td>
<td>{$form.activity_assignee_notification.html} {$form.activity_assignee_notification.label}</td>
<td>{$form.activity_assignee_notification.html}</td>
</tr>
<tr class="crm-preferences-display-form-block-description">
<td>&nbsp;</td>
Expand All @@ -145,7 +145,7 @@
</tr>
<tr class="crm-preferences-display-form-block-activity_assignee_notification_ics">
<td class="label"></td>
<td>{$form.activity_assignee_notification_ics.html} {$form.activity_assignee_notification_ics.label}</td>
<td>{$form.activity_assignee_notification_ics.html}</td>
</tr>
<tr class="crm-preferences-display-form-block-description">
<td>&nbsp;</td>
Expand Down Expand Up @@ -238,8 +238,8 @@
}

// show/hide activity types based on checkbox value
$('.crm-preferences-display-form-activity_types').toggle($('#activity_assignee_notification').is(":checked"));
$('#activity_assignee_notification').click(function() {
$('.crm-preferences-display-form-activity_types').toggle($('#activity_assignee_notification_activity_assignee_notification').is(":checked"));
$('#activity_assignee_notification_activity_assignee_notification').click(function() {
$('.crm-preferences-display-form-activity_types').toggle($(this).is(":checked"));
});

Expand Down