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 { ...@@ -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_view_options' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'contact_smart_group_display' => 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, 'advanced_search_options' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'preserve_activity_tab_filter' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
); );
public function preProcess() { public function preProcess() {
...@@ -63,11 +64,6 @@ class CRM_Admin_Form_Preferences_Display extends CRM_Admin_Form_Preferences { ...@@ -63,11 +64,6 @@ class CRM_Admin_Form_Preferences_Display extends CRM_Admin_Form_Preferences {
'title' => ts('Include ICal Invite to Activity Assignees'), 'title' => ts('Include ICal Invite to Activity Assignees'),
'weight' => 6, '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( 'contact_ajax_check_similar' => array(
'title' => ts('Check for Similar Contacts'), 'title' => ts('Check for Similar Contacts'),
'weight' => 8, 'weight' => 8,
......
...@@ -118,14 +118,16 @@ trait CRM_Admin_Form_SettingTrait { ...@@ -118,14 +118,16 @@ trait CRM_Admin_Form_SettingTrait {
foreach ($settingMetaData as $setting => $props) { foreach ($settingMetaData as $setting => $props) {
$quickFormType = $this->getQuickFormType($props); $quickFormType = $this->getQuickFormType($props);
if (isset($quickFormType)) { if (isset($quickFormType)) {
$options = NULL;
if (isset($props['pseudoconstant'])) { if (isset($props['pseudoconstant'])) {
$options = civicrm_api3('Setting', 'getoptions', [ $options = civicrm_api3('Setting', 'getoptions', [
'field' => $setting, 'field' => $setting,
]); ])['values'];
} }
else { if ($props['type'] === 'Boolean') {
$options = NULL; $options = [$props['title'] => $props['name']];
} }
//Load input as readonly whose values are overridden in civicrm.settings.php. //Load input as readonly whose values are overridden in civicrm.settings.php.
if (Civi::settings()->getMandatory($setting)) { if (Civi::settings()->getMandatory($setting)) {
$props['html_attributes']['readonly'] = TRUE; $props['html_attributes']['readonly'] = TRUE;
...@@ -138,18 +140,18 @@ trait CRM_Admin_Form_SettingTrait { ...@@ -138,18 +140,18 @@ trait CRM_Admin_Form_SettingTrait {
$props['html_type'], $props['html_type'],
$setting, $setting,
ts($props['title']), 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 ($options !== NULL) ? CRM_Utils_Array::value('html_attributes', $props, []) : NULL
); );
} }
elseif ($add == 'addSelect') { 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') { 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') { elseif ($add == 'addCheckBoxes') {
$options = array_flip($options['values']); $options = array_flip($options);
$newOptions = []; $newOptions = [];
foreach ($options as $key => $val) { foreach ($options as $key => $val) {
$newOptions[$key] = $val; $newOptions[$key] = $val;
...@@ -170,7 +172,7 @@ trait CRM_Admin_Form_SettingTrait { ...@@ -170,7 +172,7 @@ trait CRM_Admin_Form_SettingTrait {
$this->add('date', $setting, ts($props['title']), CRM_Core_SelectValues::date(NULL, 'M d')); $this->add('date', $setting, ts($props['title']), CRM_Core_SelectValues::date(NULL, 'M d'));
} }
else { 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... // Migrate to using an array as easier in smart...
$descriptions[$setting] = ts($props['description']); $descriptions[$setting] = ts($props['description']);
...@@ -204,6 +206,7 @@ trait CRM_Admin_Form_SettingTrait { ...@@ -204,6 +206,7 @@ trait CRM_Admin_Form_SettingTrait {
} }
$mapping = [ $mapping = [
'checkboxes' => 'CheckBoxes', 'checkboxes' => 'CheckBoxes',
'checkbox' => 'CheckBox',
'radio' => 'Radio', 'radio' => 'Radio',
]; ];
return $mapping[$spec['html_type']]; return $mapping[$spec['html_type']];
......
...@@ -966,28 +966,28 @@ return array( ...@@ -966,28 +966,28 @@ return array(
'group' => 'core', 'group' => 'core',
'name' => 'syncCMSEmail', 'name' => 'syncCMSEmail',
'type' => 'Boolean', 'type' => 'Boolean',
'html_type' => 'YesNo',
'quick_form_type' => 'YesNo', 'quick_form_type' => 'YesNo',
'default' => 1, 'default' => 1,
'add' => '4.7', 'add' => '4.7',
'title' => 'Sync CMS Email', 'title' => ts('Sync CMS Email'),
'is_domain' => 1, 'is_domain' => 1,
'is_contact' => 0, '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, 'help_text' => NULL,
), ),
'preserve_activity_tab_filter' => array( 'preserve_activity_tab_filter' => array(
'group_name' => 'CiviCRM Preferences', 'group_name' => 'CiviCRM Preferences',
'group' => 'core', 'group' => 'core',
'name' => 'preserve_activity_tab_filter', 'name' => 'preserve_activity_tab_filter',
'type' => 'String', 'type' => 'Boolean',
'html_type' => 'Text', 'html_type' => 'checkbox',
'default' => '0', 'default' => '0',
'add' => '4.7', 'add' => '4.7',
'title' => 'Preserve activity filters as a user preference', 'title' => ts('Preserve activity filters as a user preference'),
'is_domain' => 1, 'is_domain' => 1,
'is_contact' => 0, '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', 'description' => ts('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,
), ),
'do_not_notify_assignees_for' => array( 'do_not_notify_assignees_for' => array(
'group_name' => 'CiviCRM Preferences', 'group_name' => 'CiviCRM Preferences',
......
...@@ -155,12 +155,11 @@ ...@@ -155,12 +155,11 @@
<tr class="crm-preferences-display-form-block-preserve_activity_tab_filter"> <tr class="crm-preferences-display-form-block-preserve_activity_tab_filter">
<td class="label"></td> <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>
<tr class="crm-preferences-display-form-block-description"> <tr class="crm-preferences-display-form-block-description">
<td>&nbsp;</td> <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 class="description">{$settings_fields.preserve_activity_tab_filter.description}</td>
</td>
</tr> </tr>
<tr class="crm-preferences-display-form-block-user_dashboard_options"> <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