CRM_Admin_Form_Preferences - Fix loading of settings
authorTim Otten <totten@civicrm.org>
Thu, 17 Sep 2015 04:08:38 +0000 (21:08 -0700)
committerTim Otten <totten@civicrm.org>
Thu, 17 Sep 2015 22:49:33 +0000 (15:49 -0700)
CRM/Admin/Form/Preferences.php
CRM/Admin/Form/Preferences/Address.php

index ef88e38a5d25c801d62a9030f3ab7a7d104d8afd..d8e19ec4c80990b5ea3951680df90f185db02007 100644 (file)
@@ -85,10 +85,10 @@ class CRM_Admin_Form_Preferences extends CRM_Core_Form {
       $this->_config->contact_id = $this->_contactID;
     }
 
+    $settings = Civi::settings();
     foreach ($this->_varNames as $groupName => $settingNames) {
-      $values = CRM_Core_BAO_Setting::getItem($groupName);
-      foreach ($values as $name => $value) {
-        $this->_config->$name = $value;
+      foreach ($settingNames as $settingName => $options) {
+        $this->_config->$settingName = $settings->get($settingName);
       }
     }
     $session->pushUserContext(CRM_Utils_System::url('civicrm/admin', 'reset=1'));
index 61617e458fc8dc9156ac5f5e3ea7ec806fbbbd5f..17ec772b4723af034bf50d2bc9e5646f799c5895 100644 (file)
@@ -100,32 +100,8 @@ class CRM_Admin_Form_Preferences_Address extends CRM_Admin_Form_Preferences {
 
     $this->addressSequence = isset($newSequence) ? $newSequence : "";
 
-    if (empty($this->_config->address_format)) {
-      $defaults['address_format'] = "
-{contact.street_address}
-{contact.supplemental_address_1}
-{contact.supplemental_address_2}
-{contact.city}{, }{contact.state_province}{ }{contact.postal_code}
-{contact.country}
-";
-    }
-    else {
-      $defaults['address_format'] = $this->_config->address_format;
-    }
-
-    if (empty($this->_config->mailing_format)) {
-      $defaults['mailing_format'] = "
-{contact.addressee}
-{contact.street_address}
-{contact.supplemental_address_1}
-{contact.supplemental_address_2}
-{contact.city}{, }{contact.state_province}{ }{contact.postal_code}
-{contact.country}
-";
-    }
-    else {
-      $defaults['mailing_format'] = $this->_config->mailing_format;
-    }
+    $defaults['address_format'] = $this->_config->address_format;
+    $defaults['mailing_format'] = $this->_config->mailing_format;
 
     parent::cbsDefaultValues($defaults);