Commit d7fa9936 authored by mattwire's avatar mattwire
Browse files

Switch to \Civi::settings to get/set settings

parent 0223022f
......@@ -8,10 +8,9 @@ require_once 'CRM/Core/Form.php';
* @see http://wiki.civicrm.org/confluence/display/CRMDOC43/QuickForm+Reference
*/
class CRM_Civicrmpostcodelookup_Form_Setting extends CRM_Core_Form {
function buildQuickForm() {
$settingsStr = CRM_Core_BAO_Setting::getItem('CiviCRM Postcode Lookup', 'api_details');
function buildQuickForm() {
$settingsStr = \Civi::settings()->get('api_details');
$settingsArray = unserialize($settingsStr);
// Postcode loookup Provider
......@@ -200,11 +199,7 @@ class CRM_Civicrmpostcodelookup_Form_Setting extends CRM_Core_Form {
}
$settingsStr = serialize($settingsArray);
CRM_Core_BAO_Setting::setItem($settingsStr,
'CiviCRM Postcode Lookup',
'api_details'
);
\Civi::settings()->set('api_details', $settingsStr);
$message = "Settings saved.";
CRM_Core_Session::setStatus($message, 'Postcode Lookup', 'success');
......
......@@ -11,7 +11,7 @@ class CRM_Civicrmpostcodelookup_Page_Afd extends CRM_Civicrmpostcodelookup_Page_
#################
#Server settings
#################
$settingsStr = CRM_Core_BAO_Setting::getItem('CiviCRM Postcode Lookup', 'api_details');
$settingsStr = \Civi::settings()->get('api_details');
$settingsArray = unserialize($settingsStr);
$servertarget = $settingsArray['server'];
......
......@@ -11,7 +11,7 @@ class CRM_Civicrmpostcodelookup_Page_Civipostcode extends CRM_Civicrmpostcodeloo
#################
#Server settings
#################
$settingsStr = CRM_Core_BAO_Setting::getItem('CiviCRM Postcode Lookup', 'api_details');
$settingsStr = \Civi::settings()->get('api_details');
$settingsArray = unserialize($settingsStr);
$servertarget = $settingsArray['server'];
......
......@@ -11,7 +11,7 @@ class CRM_PostcodeLookup_Page_Ajax extends CRM_Civicrmpostcodelookup_Page_Postco
public static function getQasCredentials($account_type) {
$credentials = [];
$settingsStr = CRM_Core_BAO_Setting::getItem('CiviCRM Postcode Lookup', 'api_details');
$settingsStr = \Civi::settings()->get('api_details');
$settingsArray = unserialize($settingsStr);
$credentials['username'] = $settingsArray['username'];
......
......@@ -83,7 +83,7 @@ class CRM_Civicrmpostcodelookup_Page_GetAddressIo extends CRM_Civicrmpostcodeloo
#################
#API settings
#################
$settingsStr = CRM_Core_BAO_Setting::getItem('CiviCRM Postcode Lookup', 'api_details');
$settingsStr = \Civi::settings()->get('api_details');
$settingsArray = unserialize($settingsStr);
$servertarget = $settingsArray['server'];
......@@ -266,4 +266,4 @@ class CRM_Civicrmpostcodelookup_Page_GetAddressIo extends CRM_Civicrmpostcodeloo
return $address;
}
}
\ No newline at end of file
}
......@@ -11,7 +11,7 @@ class CRM_Civicrmpostcodelookup_Page_PostcodeAnywhere extends CRM_Civicrmpostcod
#################
#Server settings
#################
$settingsStr = CRM_Core_BAO_Setting::getItem('CiviCRM Postcode Lookup', 'api_details');
$settingsStr = \Civi::settings()->get('api_details');
$settingsArray = unserialize($settingsStr);
$servertarget = $settingsArray['server'];
......
......@@ -39,7 +39,7 @@ function civicrmpostcodelookup_civicrm_xmlMenu(&$files) {
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_install
*/
function civicrmpostcodelookup_civicrm_install() {
CRM_Core_BAO_Setting::setItem('', 'CiviCRM Postcode Lookup', 'api_details');
\Civi::settings()->set('api_details', '');
_civicrmpostcodelookup_civix_civicrm_install();
}
......@@ -149,7 +149,7 @@ function civicrmpostcodelookup_civicrm_buildForm($formName, &$form) {
];
if (in_array($formName, $postCodeLookupPages)) {
// Assign the postcode lookup provider to form, so that we can call the related function in AJAX
$settingsStr = CRM_Core_BAO_Setting::getItem('CiviCRM Postcode Lookup', 'api_details');
$settingsStr = \Civi::settings()->get('api_details');
$settingsArray = unserialize($settingsStr);
$form->assign('civiPostCodeLookupProvider', $settingsArray['provider']);
......
Supports Markdown
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