X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FAdmin%2FForm%2FPreferences%2FAddress.php;h=1f6b0cb80d635b91bca6e9674ffa3bb029ba807e;hb=ff4c746ad2762b0a99cb52078292c58fd2a8853d;hp=01862a2b486a6bb724813d3fdc42535bc4adf312;hpb=95b0090202aa538612981aa3cda2c71154397fec;p=civicrm-core.git diff --git a/CRM/Admin/Form/Preferences/Address.php b/CRM/Admin/Form/Preferences/Address.php index 01862a2b48..1f6b0cb80d 100644 --- a/CRM/Admin/Form/Preferences/Address.php +++ b/CRM/Admin/Form/Preferences/Address.php @@ -1,9 +1,9 @@ '- select -') + CRM_Core_SelectValues::addressProvider(); $this->_varNames = array( CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME => @@ -67,6 +70,8 @@ class CRM_Admin_Form_Preferences_Address extends CRM_Admin_Form_Preferences { array( 'address_standardization_provider' => array( 'html_type' => 'select', + 'title' => ts('Provider'), + 'option_values' => $addrProviders, 'weight' => 4, ), 'address_standardization_userid' => array( @@ -87,6 +92,9 @@ class CRM_Admin_Form_Preferences_Address extends CRM_Admin_Form_Preferences { parent::preProcess(); } + /** + * @return array + */ function setDefaultValues() { $defaults = array(); $defaults['address_standardization_provider'] = $this->_config->address_standardization_provider; @@ -138,34 +146,20 @@ class CRM_Admin_Form_Preferences_Address extends CRM_Admin_Form_Preferences { public function buildQuickForm() { $this->applyFilter('__ALL__', 'trim'); - // Address Standardization - $addrProviders = CRM_Core_SelectValues::addressProvider(); - $this->addElement('select', - 'address_standardization_provider', - ts('Address Provider'), - array( - '' => '- select -') + $addrProviders - ); - $this->addFormRule(array('CRM_Admin_Form_Preferences_Address', 'formRule')); //get the tokens for Mailing Label field $tokens = CRM_Core_SelectValues::contactTokens(); - natcasesort($tokens); - $this->assign('tokens', json_encode($tokens)); - - $this->add('select', 'token1', ts('Insert Token'), - $tokens, FALSE, - array( - 'size' => "5", - 'multiple' => TRUE, - 'onclick' => "return tokenReplText(this);", - ) - ); + $this->assign('tokens', CRM_Utils_Token::formatTokensForDisplay($tokens)); parent::buildQuickForm(); } + /** + * @param $fields + * + * @return bool + */ static function formRule($fields) { $p = $fields['address_standardization_provider']; $u = $fields['address_standardization_userid']; @@ -218,11 +212,8 @@ FROM civicrm_county "; $countyCount = CRM_Core_DAO::singleValueQuery($sql); if ($countyCount < 10) { - global $civicrm_root; - $sqlFilePath = $civicrm_root . DIRECTORY_SEPARATOR . 'sql' . DIRECTORY_SEPARATOR . 'counties.US.sql.gz'; - - CRM_Core_Session::setStatus("", ts('You have enabled the County option. Please ensure you populate the county table in your CiviCRM Database. You can find a list of US counties (in gzip format) in your distribution at: %1', - array(1 => $sqlFilePath)), + CRM_Core_Session::setStatus(ts('You have enabled the County option. Please ensure you populate the county table in your CiviCRM Database. You can find extensions to populate counties in the ') . CRM_Utils_System::href(ts('CiviCRM Extensions Directory'), 'civicrm/admin/extensions', array('reset' => 1), TRUE, 'extensions-addnew'), + ts('Populate counties'), "info" ); }