foreach ($this->_varNames as $groupName => $groupValues) {
foreach ($groupValues as $settingName => $fieldValue) {
$settingValue = isset($this->_config->$settingName) ? $this->_config->$settingName : NULL;
- CRM_Core_BAO_Setting::setItem($settingValue,
- $groupName,
- $settingName
- );
+ Civi::settings()->set($settingName, $settingValue);
}
}
// Update any settings stored in dynamic js
$params = $this->controller->exportValues($this->_name);
unset($params['qfKey']);
unset($params['entryURL']);
- $setInvoiceSettings = CRM_Core_BAO_Setting::setItem($params, CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings');
+ Civi::settings()->set('contribution_invoice_settings', $params);
// to set default value for 'Invoices / Credit Notes' checkbox on display preferences
$values = CRM_Core_BAO_Setting::getItem("CiviCRM Preferences");
$setInvoice = CRM_Core_DAO::VALUE_SEPARATOR .
implode(CRM_Core_DAO::VALUE_SEPARATOR, array_keys($value)) .
CRM_Core_DAO::VALUE_SEPARATOR;
- CRM_Core_BAO_Setting::setItem($values['user_dashboard_options'] .
- $setInvoice, 'CiviCRM Preferences', 'user_dashboard_options');
+ Civi::settings()->set('user_dashboard_options', $values['user_dashboard_options'] . $setInvoice);
}
else {
$setting = explode(CRM_Core_DAO::VALUE_SEPARATOR, substr($values['user_dashboard_options'], 1, -1));
$settingName = CRM_Core_DAO::VALUE_SEPARATOR .
implode(CRM_Core_DAO::VALUE_SEPARATOR, array_values($setting)) .
CRM_Core_DAO::VALUE_SEPARATOR;
- CRM_Core_BAO_Setting::setItem($settingName, 'CiviCRM Preferences', 'user_dashboard_options');
+ Civi::settings()->set('user_dashboard_options', $settingName);
}
//CRM-16691: Changes made related to settings of 'CVV'.
$settings = array_intersect_key($params, $this->_settings);
if (!in_array($displayValue, $viewOptions)) {
$existingViewOptions .= $displayValue . CRM_Core_DAO::VALUE_SEPARATOR;
- CRM_Core_BAO_Setting::setItem($existingViewOptions, CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'contact_view_options');
+ Civi::settings()->set('contact_view_options', $existingViewOptions);
CRM_Core_Session::setStatus(ts('We have automatically enabled the Mailings tab for the Contact Summary screens
so that you can view mailings sent to each contact.'), ts('Saved'), 'success');
}
// verify ssl peer option
if (isset($params['verifySSL'])) {
- CRM_Core_BAO_Setting::setItem($params['verifySSL'],
- CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
- 'verifySSL'
- );
+ Civi::settings()->set('verifySSL', $params['verifySSL']);
unset($params['verifySSL']);
}
// force secure URLs
if (isset($params['enableSSL'])) {
- CRM_Core_BAO_Setting::setItem($params['enableSSL'],
- CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
- 'enableSSL'
- );
+ Civi::settings()->set('enableSSL', $params['enableSSL']);
unset($params['enableSSL']);
}
$settings = array_intersect_key($params, $this->_settings);
$formValues['smtpPassword'] = CRM_Utils_Crypt::encrypt($formValues['smtpPassword']);
}
- CRM_Core_BAO_Setting::setItem($formValues,
- CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME,
- 'mailing_backend'
- );
+ Civi::settings()->set('mailing_backend', $formValues);
}
/**
public function setCacheCode($value) {
$this->cacheCode = $value;
if ($this->cacheCodeKey) {
- CRM_Core_BAO_Setting::setItem($value, CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, $this->cacheCodeKey);
+ Civi::settings()->set($this->cacheCodeKey, $value);
}
return $this;
}
// Previously a numeric value indicated one of 4 wysiwyg editors shipped in core, and no value indicated 'Textarea'
// Now the options are "Textarea", "CKEditor", and the rest have been dropped from core.
$newEditor = $editorID ? "CKEditor" : "Textarea";
- CRM_Core_BAO_Setting::setItem($newEditor, CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'editor_id');
+ Civi::settings()->set('editor_id', $newEditor);
return $editorID;
}
Civi::service('settings_manager')->useMandatory();
$values = CRM_Core_BAO_Setting::getItem('Test Preferences');
$this->assertEquals('/test/override', $values['overrideSetting']);
- CRM_Core_BAO_Setting::setItem('/test/database', 'Test Preferences', 'databaseSetting');
+ Civi::settings()->set('databaseSetting', '/test/database');
$values = CRM_Core_BAO_Setting::getItem('Test Preferences');
$this->assertEquals('/test/override', $values['overrideSetting']);
$this->assertEquals('/test/database', $values['databaseSetting']);
// set initial value
$_testOnChange_hookCalls = array('count' => 0);
- CRM_Core_BAO_Setting::setItem(
- array('First', 'Value'),
- 'CiviCRM Preferences',
- 'onChangeExample'
- );
+ Civi::settings()->set('onChangeExample', array('First', 'Value'));
$this->assertEquals(1, $_testOnChange_hookCalls['count']);
$this->assertEquals(array('First', 'Value'), $_testOnChange_hookCalls['newValue']);
$this->assertEquals('List of Components', $_testOnChange_hookCalls['metadata']['title']);
// change value
$_testOnChange_hookCalls = array('count' => 0);
- CRM_Core_BAO_Setting::setItem(
- array('Second', 'Value'),
- 'CiviCRM Preferences',
- 'onChangeExample'
- );
+ Civi::settings()->set('onChangeExample', array('Second', 'Value'));
$this->assertEquals(1, $_testOnChange_hookCalls['count']);
$this->assertEquals(array('First', 'Value'), $_testOnChange_hookCalls['oldValue']);
$this->assertEquals(array('Second', 'Value'), $_testOnChange_hookCalls['newValue']);
);
// turn verifySSL off
- CRM_Core_BAO_Setting::setItem('0', CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'verifySSL');
+ Civi::settings()->set('verifySSL', '0');
$this->doPayment($params);
// turn verifySSL on
- CRM_Core_BAO_Setting::setItem('0', CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'verifySSL');
+ Civi::settings()->set('verifySSL', '0');
// if subscription was successful, processor_id / subscription-id must not be null
$this->assertDBNotNull('CRM_Contribute_DAO_ContributionRecur', $recur->id, 'processor_id',
$smarty->assign('subscriptionType', 'create');
// turn verifySSL off
- CRM_Core_BAO_Setting::setItem('0', CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'verifySSL');
+ Civi::settings()->set('verifySSL', '0');
$this->doPayment($params);
// turn verifySSL on
- CRM_Core_BAO_Setting::setItem('0', CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'verifySSL');
+ Civi::settings()->set('verifySSL', '0');
// if subscription was successful, processor_id / subscription-id must not be null
$this->assertDBNotNull('CRM_Contribute_DAO_ContributionRecur', $recur->id, 'processor_id',
$this->_outBound_option = $mailingBackend['outBound_option'];
$mailingBackend['outBound_option'] = CRM_Mailing_Config::OUTBOUND_OPTION_REDIRECT_TO_DB;
- CRM_Core_BAO_Setting::setItem($mailingBackend,
- CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME,
- 'mailing_backend'
- );
+ Civi::settings()->set('mailing_backend', $mailingBackend);
$mailingBackend = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME,
'mailing_backend'
$mailingBackend['outBound_option'] = $this->_outBound_option;
- CRM_Core_BAO_Setting::setItem($mailingBackend,
- CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME,
- 'mailing_backend'
- );
+ Civi::settings()->set('mailing_backend', $mailingBackend);
}
}
'tax_term' => 'Sales Tax',
'tax_display_settings' => 'Inclusive',
);
- $setInvoiceSettings = CRM_Core_BAO_Setting::setItem($contributeSetting, CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings');
+ $setInvoiceSettings = Civi::settings()->set('contribution_invoice_settings', $contributeSetting);
// Payment Processor
$paymentProceParams = array(