Commit c89a43b3 authored by eileen's avatar eileen

Convert Preserve activity tab

parent 2e94f477
......@@ -40,6 +40,7 @@ class CRM_Admin_Form_Preferences_Display extends CRM_Admin_Form_Preferences {
'contact_view_options' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'contact_smart_group_display' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'advanced_search_options' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'preserve_activity_tab_filter' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
);
public function preProcess() {
......@@ -63,11 +64,6 @@ class CRM_Admin_Form_Preferences_Display extends CRM_Admin_Form_Preferences {
'title' => ts('Include ICal Invite to Activity Assignees'),
'weight' => 6,
),
'preserve_activity_tab_filter' => array(
'html_type' => 'checkbox',
'title' => ts('Preserve activity filters as a user preference'),
'weight' => 7,
),
'contact_ajax_check_similar' => array(
'title' => ts('Check for Similar Contacts'),
'weight' => 8,
......
......@@ -118,14 +118,16 @@ trait CRM_Admin_Form_SettingTrait {
foreach ($settingMetaData as $setting => $props) {
$quickFormType = $this->getQuickFormType($props);
if (isset($quickFormType)) {
$options = NULL;
if (isset($props['pseudoconstant'])) {
$options = civicrm_api3('Setting', 'getoptions', [
'field' => $setting,
]);
])['values'];
}
else {
$options = NULL;
if ($props['type'] === 'Boolean') {
$options = [$props['title'] => $props['name']];
}
//Load input as readonly whose values are overridden in civicrm.settings.php.
if (Civi::settings()->getMandatory($setting)) {
$props['html_attributes']['readonly'] = TRUE;
......@@ -138,18 +140,18 @@ trait CRM_Admin_Form_SettingTrait {
$props['html_type'],
$setting,
ts($props['title']),
($options !== NULL) ? $options['values'] : CRM_Utils_Array::value('html_attributes', $props, []),
($options !== NULL) ? $options : CRM_Utils_Array::value('html_attributes', $props, []),
($options !== NULL) ? CRM_Utils_Array::value('html_attributes', $props, []) : NULL
);
}
elseif ($add == 'addSelect') {
$this->addElement('select', $setting, ts($props['title']), $options['values'], CRM_Utils_Array::value('html_attributes', $props));
$this->addElement('select', $setting, ts($props['title']), $options, CRM_Utils_Array::value('html_attributes', $props));
}
elseif ($add == 'addCheckBox') {
$this->addCheckBox($setting, ts($props['title']), $options['values'], NULL, CRM_Utils_Array::value('html_attributes', $props), NULL, NULL, ['  ']);
$this->addCheckBox($setting, ts($props['title']), $options, NULL, CRM_Utils_Array::value('html_attributes', $props), NULL, NULL, ['  ']);
}
elseif ($add == 'addCheckBoxes') {
$options = array_flip($options['values']);
$options = array_flip($options);
$newOptions = [];
foreach ($options as $key => $val) {
$newOptions[$key] = $val;
......@@ -170,7 +172,7 @@ trait CRM_Admin_Form_SettingTrait {
$this->add('date', $setting, ts($props['title']), CRM_Core_SelectValues::date(NULL, 'M d'));
}
else {
$this->$add($setting, ts($props['title']), $options['values']);
$this->$add($setting, ts($props['title']), $options);
}
// Migrate to using an array as easier in smart...
$descriptions[$setting] = ts($props['description']);
......@@ -204,6 +206,7 @@ trait CRM_Admin_Form_SettingTrait {
}
$mapping = [
'checkboxes' => 'CheckBoxes',
'checkbox' => 'CheckBox',
'radio' => 'Radio',
];
return $mapping[$spec['html_type']];
......
......@@ -966,28 +966,28 @@ return array(
'group' => 'core',
'name' => 'syncCMSEmail',
'type' => 'Boolean',
'html_type' => 'YesNo',
'quick_form_type' => 'YesNo',
'default' => 1,
'add' => '4.7',
'title' => 'Sync CMS Email',
'title' => ts('Sync CMS Email'),
'is_domain' => 1,
'is_contact' => 0,
'description' => 'If enabled, then CMS email id will be syncronised with CiviCRM contacts\'s primary email.',
'description' => ts('If enabled, then CMS email id will be synchronised with CiviCRM contacts\'s primary email.'),
'help_text' => NULL,
),
'preserve_activity_tab_filter' => array(
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'preserve_activity_tab_filter',
'type' => 'String',
'html_type' => 'Text',
'type' => 'Boolean',
'html_type' => 'checkbox',
'default' => '0',
'add' => '4.7',
'title' => 'Preserve activity filters as a user preference',
'title' => ts('Preserve activity filters as a user preference'),
'is_domain' => 1,
'is_contact' => 0,
'description' => 'When enabled, any filter settings a user selects on the contact\'s Activity tab will be remembered as they visit other contacts',
'help_text' => NULL,
'description' => ts('When enabled, any filter settings a user selects on the contact\'s Activity tab will be remembered as they visit other contacts.'),
),
'do_not_notify_assignees_for' => array(
'group_name' => 'CiviCRM Preferences',
......
......@@ -155,12 +155,11 @@
<tr class="crm-preferences-display-form-block-preserve_activity_tab_filter">
<td class="label"></td>
<td>{$form.preserve_activity_tab_filter.html} {$form.preserve_activity_tab_filter.label}</td>
<td>{$form.preserve_activity_tab_filter.html}</td>
</tr>
<tr class="crm-preferences-display-form-block-description">
<td>&nbsp;</td>
<td class="description">{ts}When enabled, any filter settings a user selects on the contact's Activity tab will be remembered as they visit other contacts.{/ts}
</td>
<td class="description">{$settings_fields.preserve_activity_tab_filter.description}</td>
</tr>
<tr class="crm-preferences-display-form-block-user_dashboard_options">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment