From 5eadd1f29f13d85d8f3972a9d16aa8fe7305ac00 Mon Sep 17 00:00:00 2001 From: eileen Date: Mon, 29 Oct 2018 21:02:19 +1300 Subject: [PATCH] Fix address options page --- CRM/Admin/Form/Preferences/Address.php | 14 ++++++-------- CRM/Admin/Form/Preferences/Event.php | 1 + CRM/Core/SelectValues.php | 6 ++++-- settings/Core.setting.php | 5 +++-- settings/Event.setting.php | 4 ++-- 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/CRM/Admin/Form/Preferences/Address.php b/CRM/Admin/Form/Preferences/Address.php index c0a117709981..6e1e6e71fdf0 100644 --- a/CRM/Admin/Form/Preferences/Address.php +++ b/CRM/Admin/Form/Preferences/Address.php @@ -35,6 +35,11 @@ * This class generates form components for Address Section. */ class CRM_Admin_Form_Preferences_Address extends CRM_Admin_Form_Preferences { + + protected $_settings = [ + 'address_options' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, + ]; + public function preProcess() { CRM_Utils_System::setTitle(ts('Settings - Addresses')); @@ -46,11 +51,6 @@ public function preProcess() { $this->_varNames = array( CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME => array( - 'address_options' => array( - 'html_type' => 'checkboxes', - 'title' => ts('Address Fields'), - 'weight' => 1, - ), 'address_format' => array( 'html_type' => 'textarea', 'title' => ts('Display Format'), @@ -98,7 +98,7 @@ public function preProcess() { * @return array */ public function setDefaultValues() { - $defaults = array(); + $defaults = parent::setDefaultValues(); $defaults['address_standardization_provider'] = $this->_config->address_standardization_provider; $defaults['address_standardization_userid'] = $this->_config->address_standardization_userid; $defaults['address_standardization_url'] = $this->_config->address_standardization_url; @@ -109,8 +109,6 @@ public function setDefaultValues() { $defaults['mailing_format'] = $this->_config->mailing_format; $defaults['hideCountryMailingLabels'] = $this->_config->hideCountryMailingLabels; - parent::cbsDefaultValues($defaults); - return $defaults; } diff --git a/CRM/Admin/Form/Preferences/Event.php b/CRM/Admin/Form/Preferences/Event.php index dfd2b88808c0..b6d6d2c68c0d 100644 --- a/CRM/Admin/Form/Preferences/Event.php +++ b/CRM/Admin/Form/Preferences/Event.php @@ -41,4 +41,5 @@ class CRM_Admin_Form_Preferences_Event extends CRM_Admin_Form_Preferences { 'enable_cart' => CRM_Core_BAO_Setting::EVENT_PREFERENCES_NAME, 'show_events' => CRM_Core_BAO_Setting::EVENT_PREFERENCES_NAME, ]; + } diff --git a/CRM/Core/SelectValues.php b/CRM/Core/SelectValues.php index 184ff7e3c63c..444659b756a7 100644 --- a/CRM/Core/SelectValues.php +++ b/CRM/Core/SelectValues.php @@ -1113,10 +1113,12 @@ public static function getPermissionedRelationshipOptions() { * Get option values for dashboard entries (used for 'how many events to display on dashboard'). * * @return array - * [-1 => 'Show All', 10 => 10, 20 => 20... 100 => 100] + * Dasboard entries options - in practice [-1 => 'Show All', 10 => 10, 20 => 20, ... 100 => 100]. */ public static function getDashboardEntriesCount() { - $optionValues = [-1 => ts('show all')]; + $optionValues = [ + -1 => ts('show all'), + ]; for ($i = 10; $i <= 100; $i += 10) { $optionValues[$i] = $i; } diff --git a/settings/Core.setting.php b/settings/Core.setting.php index 996b005c3aa8..db81989ea67a 100644 --- a/settings/Core.setting.php +++ b/settings/Core.setting.php @@ -112,17 +112,18 @@ 'group' => 'core', 'name' => 'address_options', 'type' => 'String', - 'html_type' => 'Text', + 'html_type' => 'checkboxes', 'pseudoconstant' => array( 'optionGroupName' => 'address_options', ), 'default' => '123456891011', 'add' => '4.1', - 'title' => 'Addressing Options', + 'title' => ts('Address Fields'), 'is_domain' => 1, 'is_contact' => 0, 'description' => NULL, 'help_text' => NULL, + 'serialize' => CRM_Core_DAO::SERIALIZE_SEPARATOR_BOOKEND, ), 'address_format' => array( 'group_name' => 'CiviCRM Preferences', diff --git a/settings/Event.setting.php b/settings/Event.setting.php index 64de66c92b2d..5172dd11f352 100644 --- a/settings/Event.setting.php +++ b/settings/Event.setting.php @@ -48,7 +48,7 @@ 'is_contact' => 0, 'description' => ts('This feature allows users to register for more than one event at a time. When enabled, users will add event(s) to a "cart" and then pay for them all at once. Enabling this setting will affect online registration for all active events. The code is an alpha state, and you will potentially need to have developer resources to debug and fix sections of the codebase while testing and deploying it'), 'help_text' => '', - 'help_link' => ['page' => 'CiviEvent Cart Checkout', 'resource' => 'wiki'] + 'help_link' => ['page' => 'CiviEvent Cart Checkout', 'resource' => 'wiki'], ), 'show_events' => array( 'name' => 'show_events', @@ -66,6 +66,6 @@ 'help_text' => NULL, 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::getDashboardEntriesCount', - ] + ], ), );