Merge pull request #3972 from colemanw/CRM-15193
[civicrm-core.git] / CRM / Admin / Form / Preferences / Address.php
index 34c9be613ac5f3604f77f9a05620dbf4a6439990..1f6b0cb80d635b91bca6e9674ffa3bb029ba807e 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.4                                                |
+ | CiviCRM version 4.5                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013                                |
+ | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -28,7 +28,7 @@
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
  * $Id$
  *
  */
@@ -41,6 +41,9 @@ class CRM_Admin_Form_Preferences_Address extends CRM_Admin_Form_Preferences {
 
     CRM_Utils_System::setTitle(ts('Settings - Addresses'));
 
+    // Address Standardization
+    $addrProviders = array(
+      '' => '- 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,15 +146,6 @@ 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
@@ -156,6 +155,11 @@ class CRM_Admin_Form_Preferences_Address extends CRM_Admin_Form_Preferences {
     parent::buildQuickForm();
   }
 
+  /**
+   * @param $fields
+   *
+   * @return bool
+   */
   static function formRule($fields) {
     $p = $fields['address_standardization_provider'];
     $u = $fields['address_standardization_userid'];
@@ -208,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: <em>%1</em>',
-              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"
             );
           }