From aaffa79f9a2efa14d079d843f11befffd413935c Mon Sep 17 00:00:00 2001 From: jitendrapurohit Date: Wed, 18 Nov 2015 18:33:17 +0530 Subject: [PATCH] Cleanup deprecated CRM_Core_BAO_Settings calls CRM-17507 --- CRM/Activity/BAO/ICalendar.php | 2 +- CRM/Activity/Form/Activity.php | 10 ++-------- CRM/Activity/Form/ActivityFilter.php | 9 +++------ CRM/Admin/Form/Preferences/Contribute.php | 2 +- CRM/Admin/Form/Preferences/Display.php | 2 +- CRM/Admin/Form/Preferences/Mailing.php | 5 +---- CRM/Admin/Form/Setting.php | 4 ++-- CRM/Admin/Form/Setting/Smtp.php | 8 ++------ CRM/Campaign/BAO/Petition.php | 12 ++---------- CRM/Campaign/Form/Petition/Signature.php | 4 +--- CRM/Case/Form/Activity.php | 5 +---- CRM/Case/Form/Activity/OpenCase.php | 2 +- CRM/Case/XMLProcessor/Process.php | 2 +- CRM/Contact/BAO/Contact.php | 4 ++-- CRM/Contact/BAO/Group.php | 9 ++------- CRM/Contact/BAO/Individual.php | 8 ++------ CRM/Contact/BAO/Query.php | 4 +--- CRM/Contact/Form/Edit/Individual.php | 6 +----- CRM/Contact/Form/Task/EmailCommon.php | 2 +- CRM/Contact/Form/Task/Label.php | 8 ++------ CRM/Contact/Form/Task/LabelCommon.php | 12 +++--------- CRM/Contact/Page/View.php | 7 ++----- CRM/Contact/Page/View/GroupContact.php | 10 ++-------- CRM/Contact/Page/View/Summary.php | 2 +- CRM/Contribute/BAO/Contribution.php | 4 ++-- CRM/Contribute/BAO/ContributionPage.php | 2 +- CRM/Contribute/Form/AdditionalInfo.php | 2 +- CRM/Contribute/Form/AdditionalPayment.php | 4 +--- CRM/Contribute/Form/Contribution.php | 8 +++----- CRM/Contribute/Form/Contribution/Confirm.php | 4 ++-- CRM/Contribute/Form/Contribution/ThankYou.php | 2 +- CRM/Contribute/Form/ContributionView.php | 2 +- CRM/Contribute/Form/Task/Invoice.php | 2 +- CRM/Contribute/Page/UserDashboard.php | 2 +- CRM/Contribute/Task.php | 2 +- CRM/Core/BAO/Address.php | 6 ++---- CRM/Core/BAO/Domain.php | 8 ++------ CRM/Core/BAO/File.php | 8 ++++---- CRM/Core/BAO/Navigation.php | 10 +++------- CRM/Core/BAO/UFGroup.php | 8 ++------ CRM/Core/BAO/UFMatch.php | 7 +------ CRM/Core/I18n.php | 2 +- CRM/Core/Lock.php | 5 +---- CRM/Core/Payment/AuthorizeNet.php | 10 +++++----- CRM/Core/Payment/Elavon.php | 4 ++-- CRM/Core/Payment/FirstData.php | 4 ++-- CRM/Core/Payment/Google.php | 4 ++-- CRM/Core/Payment/PayPalImpl.php | 4 ++-- CRM/Core/Payment/PayflowPro.php | 4 ++-- CRM/Core/Payment/PaymentExpressUtils.php | 4 ++-- CRM/Core/Payment/Realex.php | 2 +- CRM/Core/Permission.php | 4 +--- CRM/Core/Resources.php | 6 +++--- CRM/Cxn/ApiRouter.php | 2 +- CRM/Cxn/BAO/Cxn.php | 2 +- CRM/Cxn/CiviCxnHttp.php | 2 +- CRM/Dashlet/Page/Blog.php | 2 +- CRM/Event/BAO/Event.php | 10 +++------- CRM/Event/BAO/Participant.php | 4 ++-- CRM/Event/Form/EventFees.php | 6 ++---- CRM/Event/Form/ManageEvent/TabHeader.php | 4 +--- CRM/Event/Form/Participant.php | 4 ++-- CRM/Event/Form/ParticipantView.php | 2 +- CRM/Event/Form/Registration/Confirm.php | 4 ++-- CRM/Event/Form/Registration/ThankYou.php | 2 +- CRM/Event/Page/DashBoard.php | 4 +--- CRM/Event/Page/EventInfo.php | 9 +++------ CRM/Event/Page/ICalendar.php | 4 +--- CRM/Event/Page/ManageEvent.php | 4 +--- CRM/Financial/BAO/ExportFormat/CSV.php | 2 +- CRM/Financial/BAO/FinancialItem.php | 4 ++-- CRM/Financial/BAO/FinancialType.php | 4 +--- CRM/Mailing/BAO/Mailing.php | 4 ++-- CRM/Mailing/BAO/MailingJob.php | 7 +------ CRM/Mailing/Info.php | 10 +++------- CRM/Mailing/Page/View.php | 2 +- CRM/Member/Form/Membership.php | 9 ++++----- CRM/Member/Form/MembershipRenewal.php | 6 ++---- CRM/Member/Page/UserDashboard.php | 4 +--- CRM/Pledge/Form/Pledge.php | 4 +--- CRM/Price/BAO/LineItem.php | 2 +- CRM/Price/BAO/PriceField.php | 2 +- CRM/Price/Page/Field.php | 2 +- CRM/Price/Page/Option.php | 2 +- CRM/Upgrade/Incremental/php/FourSeven.php | 2 +- CRM/Upgrade/Snapshot/V4p2/Price/BAO/Set.php | 5 +---- CRM/Utils/Address.php | 4 ++-- CRM/Utils/Address/USPS.php | 8 ++------ CRM/Utils/Check/Env.php | 2 +- CRM/Utils/Date.php | 6 +++--- CRM/Utils/HttpClient.php | 2 +- CRM/Utils/Mail.php | 8 ++------ CRM/Utils/PDF/Label.php | 2 +- CRM/Utils/QueryFormatter.php | 4 ++-- CRM/Utils/System.php | 4 ++-- CRM/Utils/System/WordPress.php | 2 +- CRM/Utils/VersionCheck.php | 2 +- settings/Event.setting.php | 15 +++++++++++++++ 98 files changed, 173 insertions(+), 295 deletions(-) diff --git a/CRM/Activity/BAO/ICalendar.php b/CRM/Activity/BAO/ICalendar.php index a6e4c40f68..c02d08ad0a 100644 --- a/CRM/Activity/BAO/ICalendar.php +++ b/CRM/Activity/BAO/ICalendar.php @@ -66,7 +66,7 @@ class CRM_Activity_BAO_ICalendar { */ public function addAttachment(&$attachments, $contacts) { // Check preferences setting - if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'activity_assignee_notification_ics')) { + if (Civi::settings()->get('activity_assignee_notification_ics')) { $config = &CRM_Core_Config::singleton(); $this->icsfile = tempnam($config->customFileUploadDir, 'ics'); if ($this->icsfile !== FALSE) { diff --git a/CRM/Activity/Form/Activity.php b/CRM/Activity/Form/Activity.php index 943b40e90b..fde9ebeac3 100644 --- a/CRM/Activity/Form/Activity.php +++ b/CRM/Activity/Form/Activity.php @@ -790,11 +790,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { $this->addFormRule(array('CRM_Activity_Form_Activity', 'formRule'), $this); - if (CRM_Core_BAO_Setting::getItem( - CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, - 'activity_assignee_notification' - ) - ) { + if (Civi::settings()->get('activity_assignee_notification')) { $this->assign('activityAssigneeNotification', TRUE); } else { @@ -1054,9 +1050,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { // send copy to assignee contacts.CRM-4509 $mailStatus = ''; - if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, - 'activity_assignee_notification') - ) { + if (Civi::settings()->get('activity_assignee_notification')) { $activityIDs = array($activity->id); if ($followupActivity) { $activityIDs = array_merge($activityIDs, array($followupActivity->id)); diff --git a/CRM/Activity/Form/ActivityFilter.php b/CRM/Activity/Form/ActivityFilter.php index 84c20e9207..bb47aafc87 100644 --- a/CRM/Activity/Form/ActivityFilter.php +++ b/CRM/Activity/Form/ActivityFilter.php @@ -60,12 +60,9 @@ class CRM_Activity_Form_ActivityFilter extends CRM_Core_Form { $session = CRM_Core_Session::singleton(); $userID = $session->get('userID'); if ($userID) { - $defaults = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::PERSONAL_PREFERENCES_NAME, - 'activity_tab_filter', - NULL, - NULL, - $userID - ); + $defaults = Civi::service('settings_manager') + ->getBagByContact(NULL, $userID) + ->get('activity_tab_filter'); } return $defaults; } diff --git a/CRM/Admin/Form/Preferences/Contribute.php b/CRM/Admin/Form/Preferences/Contribute.php index e5a46fb565..0a5513cbd2 100644 --- a/CRM/Admin/Form/Preferences/Contribute.php +++ b/CRM/Admin/Form/Preferences/Contribute.php @@ -150,7 +150,7 @@ class CRM_Admin_Form_Preferences_Contribute extends CRM_Admin_Form_Preferences { * default values are retrieved from the database */ public function setDefaultValues() { - $defaults = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings'); + $defaults = Civi::settings()->get('contribution_invoice_settings'); //CRM-16691: Changes made related to settings of 'CVV'. foreach ($this->_settings as $setting => $group) { $settingMetaData = civicrm_api3('setting', 'getfields', array('name' => $setting)); diff --git a/CRM/Admin/Form/Preferences/Display.php b/CRM/Admin/Form/Preferences/Display.php index b164585e70..6ba66f8eaf 100644 --- a/CRM/Admin/Form/Preferences/Display.php +++ b/CRM/Admin/Form/Preferences/Display.php @@ -129,7 +129,7 @@ class CRM_Admin_Form_Preferences_Display extends CRM_Admin_Form_Preferences { $wysiwyg_options = CRM_Core_OptionGroup::values('wysiwyg_editor', FALSE, FALSE, FALSE, NULL, 'label', TRUE, FALSE, 'name'); //changes for freezing the invoices/credit notes checkbox if invoicing is uncheck - $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings'); + $invoiceSettings = Civi::settings()->get('contribution_invoice_settings'); $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings); $this->assign('invoicing', $invoicing); $extra = array(); diff --git a/CRM/Admin/Form/Preferences/Mailing.php b/CRM/Admin/Form/Preferences/Mailing.php index e1beccc42e..63bdb2072a 100644 --- a/CRM/Admin/Form/Preferences/Mailing.php +++ b/CRM/Admin/Form/Preferences/Mailing.php @@ -119,10 +119,7 @@ class CRM_Admin_Form_Preferences_Mailing extends CRM_Admin_Form_Preferences { $params = $this->controller->exportValues($this->_name); if (empty($params['write_activity_record'])) { - $existingViewOptions = CRM_Core_BAO_Setting::getItem( - CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, - 'contact_view_options' - ); + $existingViewOptions = Civi::settings()->get('contact_view_options'); $displayValue = CRM_Core_OptionGroup::getValue('contact_view_options', 'CiviMail', 'name'); $viewOptions = explode(CRM_Core_DAO::VALUE_SEPARATOR, $existingViewOptions); diff --git a/CRM/Admin/Form/Setting.php b/CRM/Admin/Form/Setting.php index 60625eb657..90b494806d 100644 --- a/CRM/Admin/Form/Setting.php +++ b/CRM/Admin/Form/Setting.php @@ -68,8 +68,8 @@ class CRM_Admin_Form_Setting extends CRM_Core_Form { $this->_defaults['contact_autocomplete_options'] = self::getAutocompleteContactSearch(); $this->_defaults['contact_reference_options'] = self::getAutocompleteContactReference(); - $this->_defaults['enableSSL'] = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'enableSSL'); - $this->_defaults['verifySSL'] = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'verifySSL'); + $this->_defaults['enableSSL'] = Civi::settings()->get('enableSSL'); + $this->_defaults['verifySSL'] = Civi::settings()->get('verifySSL'); $this->_defaults['enableComponents'] = Civi::settings()->get('enable_components'); } diff --git a/CRM/Admin/Form/Setting/Smtp.php b/CRM/Admin/Form/Setting/Smtp.php index e7569919ed..25c80062e1 100644 --- a/CRM/Admin/Form/Setting/Smtp.php +++ b/CRM/Admin/Form/Setting/Smtp.php @@ -176,9 +176,7 @@ class CRM_Admin_Form_Setting_Smtp extends CRM_Admin_Form_Setting { } } - $mailingBackend = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, - 'mailing_backend' - ); + $mailingBackend = Civi::settings()->get('mailing_backend'); if (!empty($mailingBackend)) { $formValues = array_merge($mailingBackend, $formValues); @@ -240,9 +238,7 @@ class CRM_Admin_Form_Setting_Smtp extends CRM_Admin_Form_Setting { if (!$this->_defaults) { $this->_defaults = array(); - $mailingBackend = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, - 'mailing_backend' - ); + $mailingBackend = Civi::settings()->get('mailing_backend'); if (!empty($mailingBackend)) { $this->_defaults = $mailingBackend; diff --git a/CRM/Campaign/BAO/Petition.php b/CRM/Campaign/BAO/Petition.php index 03622c74b6..d5e4c0a2ec 100644 --- a/CRM/Campaign/BAO/Petition.php +++ b/CRM/Campaign/BAO/Petition.php @@ -251,11 +251,7 @@ SELECT petition.id as id, $sql = 'UPDATE civicrm_activity_contact SET contact_id = %2 WHERE activity_id = %1 AND record_type_id = %3'; CRM_Core_DAO::executeQuery($sql, $params); // remove 'Unconfirmed' tag for this contact - $tag_name = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, - 'tag_unconfirmed', - NULL, - 'Unconfirmed' - ); + $tag_name = Civi::settings()->get('tag_unconfirmed'); $sql = " DELETE FROM civicrm_entity_tag @@ -560,11 +556,7 @@ AND tag_id = ( SELECT id FROM civicrm_tag WHERE name = %2 )"; */ // check if the group defined by CIVICRM_PETITION_CONTACTS exists, else create it - $petitionGroupName = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, - 'petition_contacts', - NULL, - 'Petition Contacts' - ); + $petitionGroupName = Civi::settings()->get('petition_contacts'); $dao = new CRM_Contact_DAO_Group(); $dao->title = $petitionGroupName; diff --git a/CRM/Campaign/Form/Petition/Signature.php b/CRM/Campaign/Form/Petition/Signature.php index b4c9c19023..23ed93be12 100644 --- a/CRM/Campaign/Form/Petition/Signature.php +++ b/CRM/Campaign/Form/Petition/Signature.php @@ -327,9 +327,7 @@ class CRM_Campaign_Form_Petition_Signature extends CRM_Core_Form { * Form submission of petition signature. */ public function postProcess() { - $tag_name = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CAMPAIGN_PREFERENCES_NAME, - 'tag_unconfirmed' - ); + $tag_name = Civi::settings()->get('tag_unconfirmed'); if ($tag_name) { // Check if contact 'email confirmed' tag exists, else create one diff --git a/CRM/Case/Form/Activity.php b/CRM/Case/Form/Activity.php index 44a99f0823..03feaa4f55 100644 --- a/CRM/Case/Form/Activity.php +++ b/CRM/Case/Form/Activity.php @@ -585,10 +585,7 @@ class CRM_Case_Form_Activity extends CRM_Activity_Form_Activity { $selectedContacts = array('contact_check'); $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts); - if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, - 'activity_assignee_notification' - ) - ) { + if (Civi::settings()->get('activity_assignee_notification')) { $selectedContacts[] = 'assignee_contact_id'; } diff --git a/CRM/Case/Form/Activity/OpenCase.php b/CRM/Case/Form/Activity/OpenCase.php index d78d32617e..cd56766a80 100644 --- a/CRM/Case/Form/Activity/OpenCase.php +++ b/CRM/Case/Form/Activity/OpenCase.php @@ -330,7 +330,7 @@ class CRM_Case_Form_Activity_OpenCase { } // Add parameters for attachments - $numAttachments = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'max_attachments'); + $numAttachments = Civi::settings()->get('max_attachments'); for ($i = 1; $i <= $numAttachments; $i++) { $attachName = "attachFile_$i"; if (isset($params[$attachName]) && !empty($params[$attachName])) { diff --git a/CRM/Case/XMLProcessor/Process.php b/CRM/Case/XMLProcessor/Process.php index b97411828a..a920f9b808 100644 --- a/CRM/Case/XMLProcessor/Process.php +++ b/CRM/Case/XMLProcessor/Process.php @@ -497,7 +497,7 @@ AND a.is_deleted = 0 // Add parameters for attachments - $numAttachments = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'max_attachments'); + $numAttachments = Civi::settings()->get('max_attachments'); for ($i = 1; $i <= $numAttachments; $i++) { $attachName = "attachFile_$i"; if (isset($params[$attachName]) && !empty($params[$attachName])) { diff --git a/CRM/Contact/BAO/Contact.php b/CRM/Contact/BAO/Contact.php index 3225d8173c..13c69e603d 100644 --- a/CRM/Contact/BAO/Contact.php +++ b/CRM/Contact/BAO/Contact.php @@ -319,7 +319,7 @@ class CRM_Contact_BAO_Contact extends CRM_Contact_DAO_Contact { $params['contact_id'] = $contact->id; - if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MULTISITE_PREFERENCES_NAME, 'is_enabled')) { + if (Civi::settings()->get('is_enabled')) { // Enabling multisite causes the contact to be added to the domain group. $domainGroupID = CRM_Core_BAO_Domain::getGroupId(); if (!empty($domainGroupID)) { @@ -2352,7 +2352,7 @@ SELECT civicrm_contact.id as contact_id, FROM civicrm_contact INNER JOIN civicrm_email ON ( civicrm_contact.id = civicrm_email.contact_id )"; - if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MULTISITE_PREFERENCES_NAME, 'uniq_email_per_site')) { + if (Civi::settings()->get('uniq_email_per_site')) { // try to find a match within a site (multisite). $groups = CRM_Core_BAO_Domain::getChildGroupIds(); if (!empty($groups)) { diff --git a/CRM/Contact/BAO/Group.php b/CRM/Contact/BAO/Group.php index e8356829f5..dd44875a45 100644 --- a/CRM/Contact/BAO/Group.php +++ b/CRM/Contact/BAO/Group.php @@ -107,10 +107,7 @@ class CRM_Contact_BAO_Group extends CRM_Contact_DAO_Group { $query = "DELETE FROM civicrm_acl_entity_role where entity_table = 'civicrm_group' AND entity_id = %1"; CRM_Core_DAO::executeQuery($query, $params); - if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MULTISITE_PREFERENCES_NAME, - 'is_enabled' - ) - ) { + if (Civi::settings()->get('is_enabled')) { // clear any descendant groups cache if exists CRM_Core_BAO_Cache::deleteGroup('descendant groups for an org'); } @@ -427,9 +424,7 @@ class CRM_Contact_BAO_Group extends CRM_Contact_DAO_Group { if (CRM_Utils_Array::value('no_parent', $params) !== 1) { if (empty($params['parents']) && $domainGroupID != $group->id && - CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MULTISITE_PREFERENCES_NAME, - 'is_enabled' - ) && + Civi::settings()->get('is_enabled') && !CRM_Contact_BAO_GroupNesting::hasParentGroups($group->id) ) { // if no parent present and the group doesn't already have any parents, diff --git a/CRM/Contact/BAO/Individual.php b/CRM/Contact/BAO/Individual.php index 578fec08f5..d5346628e5 100644 --- a/CRM/Contact/BAO/Individual.php +++ b/CRM/Contact/BAO/Individual.php @@ -214,18 +214,14 @@ class CRM_Contact_BAO_Individual extends CRM_Contact_DAO_Contact { } //build the sort name. - $format = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, - 'sort_name_format' - ); + $format = Civi::settings()->get('sort_name_format'); $sortName = CRM_Utils_Address::format($formatted, $format, FALSE, FALSE, TRUE, $tokenFields ); $sortName = trim($sortName); //build the display name. - $format = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, - 'display_name_format' - ); + $format = Civi::settings()->get('display_name_format'); $displayName = CRM_Utils_Address::format($formatted, $format, FALSE, FALSE, TRUE, $tokenFields ); diff --git a/CRM/Contact/BAO/Query.php b/CRM/Contact/BAO/Query.php index e4e6a48ba6..5343c290d5 100644 --- a/CRM/Contact/BAO/Query.php +++ b/CRM/Contact/BAO/Query.php @@ -1112,9 +1112,7 @@ class CRM_Contact_BAO_Query { $this->_element["{$tName}_id"] = 1; if (substr($tName, -15) == '-state_province') { // FIXME: hack to fix CRM-1900 - $a = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, - 'address_format' - ); + $a = Civi::settings()->get('address_format'); if (substr_count($a, 'state_province_name') > 0) { $this->_pseudoConstantsSelect["{$name}-{$elementFullName}"] = array( diff --git a/CRM/Contact/Form/Edit/Individual.php b/CRM/Contact/Form/Edit/Individual.php index 9db0633cb5..dd345f21b5 100644 --- a/CRM/Contact/Form/Edit/Individual.php +++ b/CRM/Contact/Form/Edit/Individual.php @@ -96,11 +96,7 @@ class CRM_Contact_Form_Edit_Individual { } if (!$inlineEditMode) { - $checkSimilar = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, - 'contact_ajax_check_similar', - NULL, - TRUE - ); + $checkSimilar = Civi::settings()->get('contact_ajax_check_similar'); if ($checkSimilar == NULL) { $checkSimilar = 0; diff --git a/CRM/Contact/Form/Task/EmailCommon.php b/CRM/Contact/Form/Task/EmailCommon.php index 0f64c32a06..b4a5142fdd 100644 --- a/CRM/Contact/Form/Task/EmailCommon.php +++ b/CRM/Contact/Form/Task/EmailCommon.php @@ -524,7 +524,7 @@ class CRM_Contact_Form_Task_EmailCommon { $followupActivity = CRM_Activity_BAO_Activity::createFollowupActivity($activityId, $params); $followupStatus = ts('A followup activity has been scheduled.'); - if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'activity_assignee_notification')) { + if (Civi::settings()->get('activity_assignee_notification')) { if ($followupActivity) { $mailToFollowupContacts = array(); $assignee = array($followupActivity->id); diff --git a/CRM/Contact/Form/Task/Label.php b/CRM/Contact/Form/Task/Label.php index 6ea5c7fa04..1ff219d514 100644 --- a/CRM/Contact/Form/Task/Label.php +++ b/CRM/Contact/Form/Task/Label.php @@ -104,9 +104,7 @@ class CRM_Contact_Form_Task_Label extends CRM_Contact_Form_Task { $config = CRM_Core_Config::singleton(); $locName = NULL; //get the address format sequence from the config file - $mailingFormat = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, - 'mailing_format' - ); + $mailingFormat = Civi::settings()->get('mailing_format'); $sequence = CRM_Utils_Address::sequence($mailingFormat); @@ -120,9 +118,7 @@ class CRM_Contact_Form_Task_Label extends CRM_Contact_Form_Task { //build the returnproperties $returnProperties = array('display_name' => 1, 'contact_type' => 1, 'prefix_id' => 1); - $mailingFormat = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, - 'mailing_format' - ); + $mailingFormat = Civi::settings()->get('mailing_format'); $mailingFormatProperties = array(); if ($mailingFormat) { diff --git a/CRM/Contact/Form/Task/LabelCommon.php b/CRM/Contact/Form/Task/LabelCommon.php index 992b7e17ad..00d44fd329 100644 --- a/CRM/Contact/Form/Task/LabelCommon.php +++ b/CRM/Contact/Form/Task/LabelCommon.php @@ -85,9 +85,7 @@ class CRM_Contact_Form_Task_LabelCommon { //build the return properties $returnProperties = array('display_name' => 1, 'contact_type' => 1, 'prefix_id' => 1); - $mailingFormat = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, - 'mailing_format' - ); + $mailingFormat = Civi::settings()->get('mailing_format'); $mailingFormatProperties = array(); if ($mailingFormat) { @@ -252,9 +250,7 @@ class CRM_Contact_Form_Task_LabelCommon { * [street_address => 1, supplemental_address_1 => 1, supplemental_address_2 => 1] */ public static function getAddressReturnProperties() { - $mailingFormat = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, - 'mailing_format' - ); + $mailingFormat = Civi::settings()->get('mailing_format'); $addressFields = CRM_Utils_Address::sequence($mailingFormat); $addressReturnProperties = array_fill_keys($addressFields, 1); @@ -271,9 +267,7 @@ class CRM_Contact_Form_Task_LabelCommon { * @return array */ public static function getTokenData(&$contacts) { - $mailingFormat = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, - 'mailing_format' - ); + $mailingFormat = Civi::settings()->get('mailing_format'); $tokens = $tokenFields = array(); $messageToken = CRM_Utils_Token::getTokens($mailingFormat); diff --git a/CRM/Contact/Page/View.php b/CRM/Contact/Page/View.php index 449c0c2f04..499ddbcf17 100644 --- a/CRM/Contact/Page/View.php +++ b/CRM/Contact/Page/View.php @@ -153,7 +153,7 @@ class CRM_Contact_Page_View extends CRM_Core_Page { //CRM-7265 --time being fix. $config = CRM_Core_Config::singleton(); $image_URL = str_replace('https://', 'http://', $image_URL); - if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'enableSSL')) { + if (Civi::settings()->get('enableSSL')) { $image_URL = str_replace('http://', 'https://', $image_URL); } @@ -230,10 +230,7 @@ class CRM_Contact_Page_View extends CRM_Core_Page { if ($contactType == 'Organization' && CRM_Core_Permission::check('administer Multiple Organizations') && - CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MULTISITE_PREFERENCES_NAME, - 'is_enabled' - ) - ) { + Civi::settings()->get('is_enabled')) { //check is any relationship between the organization and groups $groupOrg = CRM_Contact_BAO_GroupOrganization::hasGroupAssociated($this->_contactId); if ($groupOrg) { diff --git a/CRM/Contact/Page/View/GroupContact.php b/CRM/Contact/Page/View/GroupContact.php index d5a2bf45f0..5828f414ef 100644 --- a/CRM/Contact/Page/View/GroupContact.php +++ b/CRM/Contact/Page/View/GroupContact.php @@ -58,8 +58,7 @@ class CRM_Contact_Page_View_GroupContact extends CRM_Core_Page { $this->assign_by_ref('groupOut', $out); // get the info on contact smart groups - $contactSmartGroupSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, - 'contact_smart_group_display'); + $contactSmartGroupSettings = Civi::settings()->get('contact_smart_group_display'); $this->assign('contactSmartGroupSettings', $contactSmartGroupSettings); $this->ajaxResponse['tabCount'] = count($in); @@ -172,12 +171,7 @@ class CRM_Contact_Page_View_GroupContact extends CRM_Core_Page { } $groupNum = CRM_Contact_BAO_GroupContact::getContactGroup($contactID, 'Added', NULL, TRUE, TRUE); - if ($groupNum == 1 && - $groupStatus == 'Removed' && - CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MULTISITE_PREFERENCES_NAME, - 'is_enabled' - ) - ) { + if ($groupNum == 1 && $groupStatus == 'Removed' && Civi::settings()->get('is_enabled')) { CRM_Core_Session::setStatus(ts('Please ensure at least one contact group association is maintained.'), ts('Could Not Remove')); return FALSE; } diff --git a/CRM/Contact/Page/View/Summary.php b/CRM/Contact/Page/View/Summary.php index 832fe39696..eac81adab9 100644 --- a/CRM/Contact/Page/View/Summary.php +++ b/CRM/Contact/Page/View/Summary.php @@ -141,7 +141,7 @@ class CRM_Contact_Page_View_Summary extends CRM_Contact_Page_View { $params['noRelationships'] = $params['noNotes'] = $params['noGroups'] = TRUE; $contact = CRM_Contact_BAO_Contact::retrieve($params, $defaults, TRUE); // Let summary page know if outbound mail is disabled so email links can be built conditionally - $mailingBackend = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, 'mailing_backend'); + $mailingBackend = Civi::settings()->get('mailing_backend'); $this->assign('mailingOutboundOption', $mailingBackend['outBound_option']); $communicationType = array( diff --git a/CRM/Contribute/BAO/Contribution.php b/CRM/Contribute/BAO/Contribution.php index 291793a85c..ac07672092 100644 --- a/CRM/Contribute/BAO/Contribution.php +++ b/CRM/Contribute/BAO/Contribution.php @@ -3354,7 +3354,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac CRM_Financial_BAO_FinancialItem::create($itemParams, NULL, $trxnIds); if ($fieldValues['tax_amount']) { - $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings'); + $invoiceSettings = Civi::settings()->get('contribution_invoice_settings'); $taxTerm = CRM_Utils_Array::value('tax_term', $invoiceSettings); $itemParams['amount'] = $diff * $fieldValues['tax_amount']; $itemParams['description'] = $taxTerm; @@ -4410,7 +4410,7 @@ LIMIT 1;"; * Credit Note Id. */ public static function createCreditNoteId() { - $prefixValue = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings'); + $prefixValue = Civi::settings()->get('contribution_invoice_settings'); $creditNoteNum = CRM_Core_DAO::singleValueQuery("SELECT count(creditnote_id) as creditnote_number FROM civicrm_contribution"); $creditNoteId = NULL; diff --git a/CRM/Contribute/BAO/ContributionPage.php b/CRM/Contribute/BAO/ContributionPage.php index 24be98770e..1008aef34e 100644 --- a/CRM/Contribute/BAO/ContributionPage.php +++ b/CRM/Contribute/BAO/ContributionPage.php @@ -420,7 +420,7 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio //send email with pdf invoice $template = CRM_Core_Smarty::singleton(); $taxAmt = $template->get_template_vars('dataArray'); - $prefixValue = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings'); + $prefixValue = Civi::settings()->get('contribution_invoice_settings'); $invoicing = CRM_Utils_Array::value('invoicing', $prefixValue); if (isset($invoicing) && isset($prefixValue['is_email_pdf'])) { $sendTemplateParams['isEmailPdf'] = TRUE; diff --git a/CRM/Contribute/Form/AdditionalInfo.php b/CRM/Contribute/Form/AdditionalInfo.php index 455ddd9154..d59606a1a1 100644 --- a/CRM/Contribute/Form/AdditionalInfo.php +++ b/CRM/Contribute/Form/AdditionalInfo.php @@ -476,7 +476,7 @@ class CRM_Contribute_Form_AdditionalInfo { $template = CRM_Core_Smarty::singleton(); $taxAmt = $template->get_template_vars('dataArray'); $eventTaxAmt = $template->get_template_vars('totalTaxAmount'); - $prefixValue = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings'); + $prefixValue = Civi::settings()->get('contribution_invoice_settings'); $invoicing = CRM_Utils_Array::value('invoicing', $prefixValue); if ((!empty($taxAmt) || isset($eventTaxAmt)) && (isset($invoicing) && isset($prefixValue['is_email_pdf']))) { $isEmailPdf = TRUE; diff --git a/CRM/Contribute/Form/AdditionalPayment.php b/CRM/Contribute/Form/AdditionalPayment.php index 49bd5e98a0..641d560d51 100644 --- a/CRM/Contribute/Form/AdditionalPayment.php +++ b/CRM/Contribute/Form/AdditionalPayment.php @@ -329,9 +329,7 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract ), ) ); - $mailingInfo = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, - 'mailing_backend' - ); + $mailingInfo = Civi::settings()->get('mailing_backend'); $this->assign('outBound_option', $mailingInfo['outBound_option']); $this->addFormRule(array('CRM_Contribute_Form_AdditionalPayment', 'formRule'), $this); diff --git a/CRM/Contribute/Form/Contribution.php b/CRM/Contribute/Form/Contribution.php index e9d5bb8db2..71de60eb75 100644 --- a/CRM/Contribute/Form/Contribution.php +++ b/CRM/Contribute/Form/Contribution.php @@ -477,7 +477,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP // build price set form. $buildPriceSet = FALSE; - $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings'); + $invoiceSettings = Civi::settings()->get('contribution_invoice_settings'); $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings); $this->assign('invoicing', $invoicing); @@ -832,9 +832,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP $js = array('onclick' => "return verify( );"); } - $mailingInfo = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, - 'mailing_backend' - ); + $mailingInfo = Civi::settings()->get('mailing_backend'); $this->assign('outBound_option', $mailingInfo['outBound_option']); $this->addButtons(array( @@ -1735,7 +1733,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP */ protected function invoicingPostProcessHook($submittedValues, $action, $lineItem) { - $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings'); + $invoiceSettings = Civi::settings()->get('contribution_invoice_settings'); if (!CRM_Utils_Array::value('invoicing', $invoiceSettings)) { return; } diff --git a/CRM/Contribute/Form/Contribution/Confirm.php b/CRM/Contribute/Form/Contribution/Confirm.php index 38c8bafb44..399b429c73 100644 --- a/CRM/Contribute/Form/Contribution/Confirm.php +++ b/CRM/Contribute/Form/Contribution/Confirm.php @@ -405,7 +405,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr $amount_block_is_active = $this->get('amount_block_is_active'); $this->assign('amount_block_is_active', $amount_block_is_active); - $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings'); + $invoiceSettings = Civi::settings()->get('contribution_invoice_settings'); $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings); if ($invoicing) { $getTaxDetails = FALSE; @@ -854,7 +854,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr ); $contribution = CRM_Contribute_BAO_Contribution::add($contributionParams); - $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings'); + $invoiceSettings = Civi::settings()->get('contribution_invoice_settings'); $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings); if ($invoicing) { $dataArray = array(); diff --git a/CRM/Contribute/Form/Contribution/ThankYou.php b/CRM/Contribute/Form/Contribution/ThankYou.php index 972994b7fa..4e431d891e 100644 --- a/CRM/Contribute/Form/Contribution/ThankYou.php +++ b/CRM/Contribute/Form/Contribution/ThankYou.php @@ -110,7 +110,7 @@ class CRM_Contribute_Form_Contribution_ThankYou extends CRM_Contribute_Form_Cont $this->assign('useForMember', $this->get('useForMember')); $params = $this->_params; - $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings'); + $invoiceSettings = Civi::settings()->get('contribution_invoice_settings'); $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings); if ($invoicing) { $getTaxDetails = FALSE; diff --git a/CRM/Contribute/Form/ContributionView.php b/CRM/Contribute/Form/ContributionView.php index 62580e0a00..d89a611de2 100644 --- a/CRM/Contribute/Form/ContributionView.php +++ b/CRM/Contribute/Form/ContributionView.php @@ -167,7 +167,7 @@ class CRM_Contribute_Form_ContributionView extends CRM_Core_Form { // assign values to the template $this->assign($values); - $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings'); + $invoiceSettings = Civi::settings()->get('contribution_invoice_settings'); $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings); $this->assign('invoicing', $invoicing); if ($invoicing && isset($values['tax_amount'])) { diff --git a/CRM/Contribute/Form/Task/Invoice.php b/CRM/Contribute/Form/Task/Invoice.php index 454b4c33d0..f0a0c912ec 100644 --- a/CRM/Contribute/Form/Task/Invoice.php +++ b/CRM/Contribute/Form/Task/Invoice.php @@ -247,7 +247,7 @@ class CRM_Contribute_Form_Task_Invoice extends CRM_Contribute_Form_Task { $cancelledStatusId = CRM_Utils_Array::key('Cancelled', $contributionStatusID); // getting data from admin page - $prefixValue = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings'); + $prefixValue = Civi::settings()->get('contribution_invoice_settings'); foreach ($invoiceElements['details'] as $contribID => $detail) { $input = $ids = $objects = array(); diff --git a/CRM/Contribute/Page/UserDashboard.php b/CRM/Contribute/Page/UserDashboard.php index 2e16e0b1dd..b255854d0c 100644 --- a/CRM/Contribute/Page/UserDashboard.php +++ b/CRM/Contribute/Page/UserDashboard.php @@ -139,7 +139,7 @@ class CRM_Contribute_Page_UserDashboard extends CRM_Contact_Page_View_UserDashBo * loads, it decides the which action has to be taken for the page. */ public function run() { - $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings'); + $invoiceSettings = Civi::settings()->get('contribution_invoice_settings'); $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings); $this->assign('invoicing', $invoicing); parent::preProcess(); diff --git a/CRM/Contribute/Task.php b/CRM/Contribute/Task.php index 8de48e139d..fae3005e3c 100644 --- a/CRM/Contribute/Task.php +++ b/CRM/Contribute/Task.php @@ -126,7 +126,7 @@ class CRM_Contribute_Task { } // remove action "Invoices - print or email" - $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings'); + $invoiceSettings = Civi::settings()->get('contribution_invoice_settings'); $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings); if (!$invoicing) { unset(self::$_tasks[9]); diff --git a/CRM/Core/BAO/Address.php b/CRM/Core/BAO/Address.php index 5beb1e53ed..acc47d95ab 100644 --- a/CRM/Core/BAO/Address.php +++ b/CRM/Core/BAO/Address.php @@ -342,9 +342,7 @@ class CRM_Core_BAO_Address extends CRM_Core_DAO_Address { $config = CRM_Core_Config::singleton(); - $asp = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::ADDRESS_STANDARDIZATION_PREFERENCES_NAME, - 'address_standardization_provider' - ); + $asp = Civi::settings()->get('address_standardization_provider'); // clean up the address via USPS web services if enabled if ($asp === 'USPS' && $params['country_id'] == 1228 @@ -1039,7 +1037,7 @@ SELECT is_primary, 'first_name' => $rows[$rowID]['first_name'], 'individual_prefix' => $rows[$rowID]['individual_prefix'], ); - $format = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'display_name_format'); + $format = Civi::settings()->get('display_name_format'); $firstNameWithPrefix = CRM_Utils_Address::format($formatted, $format, FALSE, FALSE, TRUE); $firstNameWithPrefix = trim($firstNameWithPrefix); diff --git a/CRM/Core/BAO/Domain.php b/CRM/Core/BAO/Domain.php index 6ac3a75664..ffc1709fae 100644 --- a/CRM/Core/BAO/Domain.php +++ b/CRM/Core/BAO/Domain.php @@ -253,12 +253,8 @@ class CRM_Core_BAO_Domain extends CRM_Core_DAO_Domain { return $groupID; } - $domainGroupID = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MULTISITE_PREFERENCES_NAME, - 'domain_group_id' - ); - $multisite = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MULTISITE_PREFERENCES_NAME, - 'is_enabled' - ); + $domainGroupID = Civi::settings()->get('domain_group_id'); + $multisite = Civi::settings()->get('is_enabled'); if ($domainGroupID) { $groupID = $domainGroupID; diff --git a/CRM/Core/BAO/File.php b/CRM/Core/BAO/File.php index c9456b3231..d3d9d00736 100644 --- a/CRM/Core/BAO/File.php +++ b/CRM/Core/BAO/File.php @@ -413,7 +413,7 @@ AND CEF.entity_id = %2"; public static function buildAttachment(&$form, $entityTable, $entityID = NULL, $numAttachments = NULL, $ajaxDelete = FALSE) { if (!$numAttachments) { - $numAttachments = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'max_attachments'); + $numAttachments = Civi::settings()->get('max_attachments'); } // Assign maxAttachments count to template for help message $form->assign('maxAttachments', $numAttachments); @@ -530,7 +530,7 @@ AND CEF.entity_id = %2"; CRM_Core_BAO_File::deleteEntityFile($entityTable, $entityID); } - $numAttachments = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'max_attachments'); + $numAttachments = Civi::settings()->get('max_attachments'); $now = date('Ymdhis'); @@ -572,7 +572,7 @@ AND CEF.entity_id = %2"; * @param int $entityID */ public static function processAttachment(&$params, $entityTable, $entityID) { - $numAttachments = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'max_attachments'); + $numAttachments = Civi::settings()->get('max_attachments'); for ($i = 1; $i <= $numAttachments; $i++) { if ( @@ -598,7 +598,7 @@ AND CEF.entity_id = %2"; * @return array */ public static function uploadNames() { - $numAttachments = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'max_attachments'); + $numAttachments = Civi::settings()->get('max_attachments'); $names = array(); for ($i = 1; $i <= $numAttachments; $i++) { diff --git a/CRM/Core/BAO/Navigation.php b/CRM/Core/BAO/Navigation.php index 4d93fd71ff..0a5c7da17a 100644 --- a/CRM/Core/BAO/Navigation.php +++ b/CRM/Core/BAO/Navigation.php @@ -1097,13 +1097,9 @@ ORDER BY parent_id, weight"; * @return object|string */ public static function getCacheKey($cid) { - $key = CRM_Core_BAO_Setting::getItem( - CRM_Core_BAO_Setting::PERSONAL_PREFERENCES_NAME, - 'navigation', - NULL, - '', - $cid - ); + $key = Civi::service('settings_manager') + ->getBagByContact(NULL, $cid) + ->get('navigation'); if (strlen($key) !== self::CACHE_KEY_STRLEN) { $key = self::resetNavigation($cid); } diff --git a/CRM/Core/BAO/UFGroup.php b/CRM/Core/BAO/UFGroup.php index 3a1c3b5b1c..1f52489a14 100644 --- a/CRM/Core/BAO/UFGroup.php +++ b/CRM/Core/BAO/UFGroup.php @@ -3611,9 +3611,7 @@ SELECT group_id // check for double optin $config = CRM_Core_Config::singleton(); if (in_array('CiviMail', $config->enableComponents)) { - return CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, - 'profile_double_optin', NULL, FALSE - ); + return Civi::settings()->get('profile_double_optin'); } return FALSE; } @@ -3625,9 +3623,7 @@ SELECT group_id // check for add to group double optin $config = CRM_Core_Config::singleton(); if (in_array('CiviMail', $config->enableComponents)) { - return CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, - 'profile_add_to_group_double_optin', NULL, FALSE - ); + return Civi::settings()->get('profile_add_to_group_double_optin'); } return FALSE; } diff --git a/CRM/Core/BAO/UFMatch.php b/CRM/Core/BAO/UFMatch.php index e6891dccfc..84bacc1c4c 100644 --- a/CRM/Core/BAO/UFMatch.php +++ b/CRM/Core/BAO/UFMatch.php @@ -209,12 +209,7 @@ class CRM_Core_BAO_UFMatch extends CRM_Core_DAO_UFMatch { $dedupeParams['check_permission'] = FALSE; $ids = CRM_Dedupe_Finder::dupesByParams($dedupeParams, 'Individual'); - if (!empty($ids) && - CRM_Core_BAO_Setting::getItem( - CRM_Core_BAO_Setting::MULTISITE_PREFERENCES_NAME, - 'uniq_email_per_site' - ) - ) { + if (!empty($ids) && Civi::settings()->get('uniq_email_per_site')) { // restrict dupeIds to ones that belong to current domain/site. $siteContacts = CRM_Core_BAO_Domain::getContactList(); foreach ($ids as $index => $dupeId) { diff --git a/CRM/Core/I18n.php b/CRM/Core/I18n.php index d16b380feb..59a5f7b2c7 100644 --- a/CRM/Core/I18n.php +++ b/CRM/Core/I18n.php @@ -637,7 +637,7 @@ class CRM_Core_I18n { * @return string */ public static function getContactDefaultLanguage() { - $language = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::LOCALIZATION_PREFERENCES_NAME, 'contact_default_language'); + $language = Civi::settings()->get('contact_default_language'); if ($language == 'undefined') { return NULL; } diff --git a/CRM/Core/Lock.php b/CRM/Core/Lock.php index 2f37b2dbad..b594e0b0ef 100644 --- a/CRM/Core/Lock.php +++ b/CRM/Core/Lock.php @@ -89,10 +89,7 @@ class CRM_Core_Lock implements \Civi\Core\Lock\LockInterface { * @deprecated */ public static function createCivimailLock($name) { - $serverWideLock = \CRM_Core_BAO_Setting::getItem( - \CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, - 'civimail_server_wide_lock' - ); + $serverWideLock = \Civi::settings()->get('civimail_server_wide_lock'); return new static($name, NULL, $serverWideLock); } diff --git a/CRM/Core/Payment/AuthorizeNet.php b/CRM/Core/Payment/AuthorizeNet.php index a112cd5066..aca12821e6 100644 --- a/CRM/Core/Payment/AuthorizeNet.php +++ b/CRM/Core/Payment/AuthorizeNet.php @@ -156,7 +156,7 @@ class CRM_Core_Payment_AuthorizeNet extends CRM_Core_Payment { curl_setopt($submit, CURLOPT_POST, TRUE); curl_setopt($submit, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($submit, CURLOPT_POSTFIELDS, implode('&', $postFields)); - curl_setopt($submit, CURLOPT_SSL_VERIFYPEER, CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'verifySSL')); + curl_setopt($submit, CURLOPT_SSL_VERIFYPEER, Civi::settings()->get('verifySSL')); $response = curl_exec($submit); @@ -315,7 +315,7 @@ class CRM_Core_Payment_AuthorizeNet extends CRM_Core_Payment { curl_setopt($submit, CURLOPT_HEADER, 1); curl_setopt($submit, CURLOPT_POSTFIELDS, $arbXML); curl_setopt($submit, CURLOPT_POST, 1); - curl_setopt($submit, CURLOPT_SSL_VERIFYPEER, CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'verifySSL')); + curl_setopt($submit, CURLOPT_SSL_VERIFYPEER, Civi::settings()->get('verifySSL')); $response = curl_exec($submit); @@ -670,7 +670,7 @@ class CRM_Core_Payment_AuthorizeNet extends CRM_Core_Payment { curl_setopt($submit, CURLOPT_HEADER, 1); curl_setopt($submit, CURLOPT_POSTFIELDS, $arbXML); curl_setopt($submit, CURLOPT_POST, 1); - curl_setopt($submit, CURLOPT_SSL_VERIFYPEER, CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'verifySSL')); + curl_setopt($submit, CURLOPT_SSL_VERIFYPEER, Civi::settings()->get('verifySSL')); $response = curl_exec($submit); @@ -729,7 +729,7 @@ class CRM_Core_Payment_AuthorizeNet extends CRM_Core_Payment { curl_setopt($submit, CURLOPT_HEADER, 1); curl_setopt($submit, CURLOPT_POSTFIELDS, $arbXML); curl_setopt($submit, CURLOPT_POST, 1); - curl_setopt($submit, CURLOPT_SSL_VERIFYPEER, CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'verifySSL')); + curl_setopt($submit, CURLOPT_SSL_VERIFYPEER, Civi::settings()->get('verifySSL')); $response = curl_exec($submit); @@ -791,7 +791,7 @@ class CRM_Core_Payment_AuthorizeNet extends CRM_Core_Payment { curl_setopt($submit, CURLOPT_HEADER, 1); curl_setopt($submit, CURLOPT_POSTFIELDS, $arbXML); curl_setopt($submit, CURLOPT_POST, 1); - curl_setopt($submit, CURLOPT_SSL_VERIFYPEER, CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'verifySSL')); + curl_setopt($submit, CURLOPT_SSL_VERIFYPEER, Civi::settings()->get('verifySSL')); $response = curl_exec($submit); diff --git a/CRM/Core/Payment/Elavon.php b/CRM/Core/Payment/Elavon.php index 5efc2c47e0..9e5f68405f 100644 --- a/CRM/Core/Payment/Elavon.php +++ b/CRM/Core/Payment/Elavon.php @@ -161,8 +161,8 @@ class CRM_Core_Payment_Elavon extends CRM_Core_Payment { return self::errorExit(9004, 'Could not initiate connection to payment gateway'); } - curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'verifySSL') ? 2 : 0); - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'verifySSL')); + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, Civi::settings()->get('verifySSL') ? 2 : 0); + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, Civi::settings()->get('verifySSL')); // return the result on success, FALSE on failure curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 36000); diff --git a/CRM/Core/Payment/FirstData.php b/CRM/Core/Payment/FirstData.php index daaaf465a4..116d2322ba 100644 --- a/CRM/Core/Payment/FirstData.php +++ b/CRM/Core/Payment/FirstData.php @@ -210,8 +210,8 @@ class CRM_Core_Payment_FirstData extends CRM_Core_Payment { curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $requestxml); curl_setopt($ch, CURLOPT_SSLCERT, $key); - curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'verifySSL') ? 2 : 0); - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'verifySSL')); + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, Civi::settings()->get('verifySSL') ? 2 : 0); + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, Civi::settings()->get('verifySSL')); // return the result on success, FALSE on failure curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 36000); diff --git a/CRM/Core/Payment/Google.php b/CRM/Core/Payment/Google.php index b1837d5c05..3d82a5df43 100644 --- a/CRM/Core/Payment/Google.php +++ b/CRM/Core/Payment/Google.php @@ -294,8 +294,8 @@ class CRM_Core_Payment_Google extends CRM_Core_Payment { curl_setopt($ch, CURLOPT_VERBOSE, 1); //turning off the server and peer verification(TrustManager Concept). - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'verifySSL')); - curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'verifySSL') ? 2 : 0); + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, Civi::settings()->get('verifySSL')); + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, Civi::settings()->get('verifySSL') ? 2 : 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); diff --git a/CRM/Core/Payment/PayPalImpl.php b/CRM/Core/Payment/PayPalImpl.php index 24f572ac7c..377a5613d3 100644 --- a/CRM/Core/Payment/PayPalImpl.php +++ b/CRM/Core/Payment/PayPalImpl.php @@ -979,8 +979,8 @@ class CRM_Core_Payment_PayPalImpl extends CRM_Core_Payment { curl_setopt($ch, CURLOPT_VERBOSE, 1); //turning off the server and peer verification(TrustManager Concept). - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'verifySSL')); - curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'verifySSL') ? 2 : 0); + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, Civi::settings()->get('verifySSL')); + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, Civi::settings()->get('verifySSL') ? 2 : 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); diff --git a/CRM/Core/Payment/PayflowPro.php b/CRM/Core/Payment/PayflowPro.php index ee5a2bddc4..f94448c533 100644 --- a/CRM/Core/Payment/PayflowPro.php +++ b/CRM/Core/Payment/PayflowPro.php @@ -495,11 +495,11 @@ class CRM_Core_Payment_PayflowPro extends CRM_Core_Payment { if (ini_get('open_basedir') == '' && ini_get('safe_mode') == 'Off') { curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); } - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'verifySSL')); + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, Civi::settings()->get('verifySSL')); // this line makes it work under https curl_setopt($ch, CURLOPT_POSTFIELDS, $payflow_query); //adding POST data - curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'verifySSL') ? 2 : 0); + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, Civi::settings()->get('verifySSL') ? 2 : 0); //verifies ssl certificate curl_setopt($ch, CURLOPT_FORBID_REUSE, TRUE); //forces closure of connection when done diff --git a/CRM/Core/Payment/PaymentExpressUtils.php b/CRM/Core/Payment/PaymentExpressUtils.php index dd36b19b6c..194f870b9b 100644 --- a/CRM/Core/Payment/PaymentExpressUtils.php +++ b/CRM/Core/Payment/PaymentExpressUtils.php @@ -101,8 +101,8 @@ class CRM_Core_Payment_PaymentExpressUtils { curl_setopt($curl, CURLOPT_SSLVERSION, 0); if (strtoupper(substr(@php_uname('s'), 0, 3)) === 'WIN') { - curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'verifySSL')); - curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'verifySSL') ? 2 : 0); + curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, Civi::settings()->get('verifySSL')); + curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, Civi::settings()->get('verifySSL') ? 2 : 0); } return $curl; } diff --git a/CRM/Core/Payment/Realex.php b/CRM/Core/Payment/Realex.php index 077db4b72b..9af1649742 100644 --- a/CRM/Core/Payment/Realex.php +++ b/CRM/Core/Payment/Realex.php @@ -150,7 +150,7 @@ class CRM_Core_Payment_Realex extends CRM_Core_Payment { curl_setopt($submit, CURLOPT_HTTPHEADER, array('SOAPAction: ""')); curl_setopt($submit, CURLOPT_RETURNTRANSFER, 1); curl_setopt($submit, CURLOPT_TIMEOUT, 60); - curl_setopt($submit, CURLOPT_SSL_VERIFYPEER, CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'verifySSL')); + curl_setopt($submit, CURLOPT_SSL_VERIFYPEER, Civi::settings()->get('verifySSL')); curl_setopt($submit, CURLOPT_HEADER, 0); // take caching out of the picture diff --git a/CRM/Core/Permission.php b/CRM/Core/Permission.php index d3eb354d0a..554d31d5a9 100644 --- a/CRM/Core/Permission.php +++ b/CRM/Core/Permission.php @@ -956,9 +956,7 @@ class CRM_Core_Permission { * @return bool */ public static function isMultisiteEnabled() { - return CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MULTISITE_PREFERENCES_NAME, - 'is_enabled' - ) ? TRUE : FALSE; + return Civi::settings()->get('is_enabled') ? TRUE : FALSE; } /** diff --git a/CRM/Core/Resources.php b/CRM/Core/Resources.php index 95a74f13e8..08d6f05a09 100644 --- a/CRM/Core/Resources.php +++ b/CRM/Core/Resources.php @@ -140,7 +140,7 @@ class CRM_Core_Resources { $this->strings = new CRM_Core_Resources_Strings($cache); $this->cacheCodeKey = $cacheCodeKey; if ($cacheCodeKey !== NULL) { - $this->cacheCode = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, $cacheCodeKey); + $this->cacheCode = Civi::settings()->get($cacheCodeKey); } if (!$this->cacheCode) { $this->resetCacheCode(); @@ -644,7 +644,7 @@ class CRM_Core_Resources { if (!empty($config->customCSSURL)) { $this->addStyleUrl($config->customCSSURL, 99, $region); } - if (!CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'disable_core_css')) { + if (!Civi::settings()->get('disable_core_css')) { $this->addStyleFile('civicrm', 'css/civicrm.css', -99, $region); } // crm-i.css added ahead of other styles so it can be overridden by FA. @@ -724,7 +724,7 @@ class CRM_Core_Resources { "js/wysiwyg/crm.wysiwyg.js", ); // add wysiwyg editor - $editor = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'editor_id'); + $editor = Civi::settings()->get('editor_id'); if ($editor == "CKEditor") { $items[] = "js/wysiwyg/crm.ckeditor.js"; $ckConfig = CRM_Admin_Page_CKEditorConfig::getConfigUrl(); diff --git a/CRM/Cxn/ApiRouter.php b/CRM/Cxn/ApiRouter.php index 5642a0a56e..c53ade7bd4 100644 --- a/CRM/Cxn/ApiRouter.php +++ b/CRM/Cxn/ApiRouter.php @@ -46,7 +46,7 @@ class CRM_Cxn_ApiRouter { require_once 'api/v3/utils.php'; // FIXME: Shouldn't the X-Forwarded-Proto check be part of CRM_Utils_System::isSSL()? - if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'enableSSL') && + if (Civi::settings()->get('enableSSL') && !CRM_Utils_System::isSSL() && strtolower(CRM_Utils_Array::value('X_FORWARDED_PROTO', CRM_Utils_System::getRequestHeaders())) != 'https' ) { diff --git a/CRM/Cxn/BAO/Cxn.php b/CRM/Cxn/BAO/Cxn.php index b8f4415080..16d5fe25f9 100644 --- a/CRM/Cxn/BAO/Cxn.php +++ b/CRM/Cxn/BAO/Cxn.php @@ -56,7 +56,7 @@ class CRM_Cxn_BAO_Cxn extends CRM_Cxn_DAO_Cxn { // In practice, this may not be necessary, but we want to prevent // edge-cases that downgrade security-level below system policy. - if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'enableSSL')) { + if (Civi::settings()->get('enableSSL')) { $civiUrl = preg_replace('/^http:/', 'https:', $civiUrl); } diff --git a/CRM/Cxn/CiviCxnHttp.php b/CRM/Cxn/CiviCxnHttp.php index d1b5e7f48b..da03e65167 100644 --- a/CRM/Cxn/CiviCxnHttp.php +++ b/CRM/Cxn/CiviCxnHttp.php @@ -83,7 +83,7 @@ class CRM_Cxn_CiviCxnHttp extends \Civi\Cxn\Rpc\Http\PhpHttp { $result = parent::createStreamOpts($verb, $url, $blob, $headers); $caConfig = CA_Config_Stream::probe(array( - 'verify_peer' => (bool) CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'verifySSL'), + 'verify_peer' => (bool) Civi::settings()->get('verifySSL'), )); if ($caConfig->isEnableSSL()) { $result['ssl'] = $caConfig->toStreamOptions(); diff --git a/CRM/Dashlet/Page/Blog.php b/CRM/Dashlet/Page/Blog.php index f5fad57bd7..0b019f6b6d 100644 --- a/CRM/Dashlet/Page/Blog.php +++ b/CRM/Dashlet/Page/Blog.php @@ -50,7 +50,7 @@ class CRM_Dashlet_Page_Blog extends CRM_Core_Page { public function getBlogUrl() { // Note: We use "*default*" as the default (rather than self::BLOG_URL) so that future // developers can change BLOG_URL without needing to update {civicrm_setting}. - $url = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'blogUrl', NULL, '*default*'); + $url = Civi::settings()->get('blogUrl'); if ($url === '*default*') { $url = self::BLOG_URL; } diff --git a/CRM/Event/BAO/Event.php b/CRM/Event/BAO/Event.php index cce8709032..d499e45c74 100644 --- a/CRM/Event/BAO/Event.php +++ b/CRM/Event/BAO/Event.php @@ -380,9 +380,7 @@ WHERE civicrm_event.is_active = 1 AND $optionGroupId = $optionGroupDAO->id; } // Get the event summary display preferences - $show_max_events = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::EVENT_PREFERENCES_NAME, - 'show_events' - ); + $show_max_events = Civi::settings()->get('show_events'); // default to 10 if no option is set if (is_null($show_max_events)) { $show_max_events = 10; @@ -847,9 +845,7 @@ WHERE civicrm_event.is_active = 1 $permissions = CRM_Core_Permission::event(CRM_Core_Permission::VIEW); // check if we're in shopping cart mode for events - $enable_cart = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::EVENT_PREFERENCES_NAME, - 'enable_cart' - ); + $enable_cart = Civi::settings()->get('enable_cart'); if ($enable_cart) { } while ($dao->fetch()) { @@ -1240,7 +1236,7 @@ WHERE civicrm_event.is_active = 1 // append invoice pdf to email $template = CRM_Core_Smarty::singleton(); $taxAmt = $template->get_template_vars('totalTaxAmount'); - $prefixValue = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings'); + $prefixValue = Civi::settings()->get('contribution_invoice_settings'); $invoicing = CRM_Utils_Array::value('invoicing', $prefixValue); if (isset($invoicing) && isset($prefixValue['is_email_pdf']) && !empty($values['contributionId'])) { $sendTemplateParams['isEmailPdf'] = TRUE; diff --git a/CRM/Event/BAO/Participant.php b/CRM/Event/BAO/Participant.php index ea73cc3850..8cc1ade13c 100644 --- a/CRM/Event/BAO/Participant.php +++ b/CRM/Event/BAO/Participant.php @@ -1905,7 +1905,7 @@ GROUP BY li.entity_table, li.entity_id, price_field_value_id $updateFinancialItemInfoDAO = CRM_Core_DAO::executeQuery($updateFinancialItem); $trxn = CRM_Core_BAO_FinancialTrxn::getFinancialTrxnId($contributionId, 'DESC', TRUE); $trxnId['id'] = $trxn['financialTrxnId']; - $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings'); + $invoiceSettings = Civi::settings()->get('contribution_invoice_settings'); $taxTerm = CRM_Utils_Array::value('tax_term', $invoiceSettings); $updateFinancialItemInfoValues = array(); $financialItemsArray = array(); @@ -2210,7 +2210,7 @@ WHERE (entity_table = 'civicrm_participant' AND entity_id = {$participantId} AND if ($fieldName == 'status_id' && $context != 'validate') { // Get rid of cart-related option if disabled // FIXME: Why does this option even exist if cart is disabled? - if (!CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::EVENT_PREFERENCES_NAME, 'enable_cart')) { + if (!Civi::settings()->get('enable_cart')) { $params['condition'][] = "name <> 'Pending in cart'"; } } diff --git a/CRM/Event/Form/EventFees.php b/CRM/Event/Form/EventFees.php index 92dc9a4b16..54c4ca7756 100644 --- a/CRM/Event/Form/EventFees.php +++ b/CRM/Event/Form/EventFees.php @@ -370,7 +370,7 @@ SELECT id, html_type CRM_Event_Form_Registration::initEventFee($form, $event['id']); CRM_Event_Form_Registration_Register::buildAmount($form, TRUE, $form->_discountId); $lineItem = array(); - $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings'); + $invoiceSettings = Civi::settings()->get('contribution_invoice_settings'); $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings); $totalTaxAmount = 0; if (!CRM_Utils_System::isNull(CRM_Utils_Array::value('line_items', $form->_values))) { @@ -507,9 +507,7 @@ SELECT id, html_type } } - $mailingInfo = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, - 'mailing_backend' - ); + $mailingInfo = Civi::settings()->get('mailing_backend'); $form->assign('outBound_option', $mailingInfo['outBound_option']); $form->assign('hasPayment', $form->_paymentId); } diff --git a/CRM/Event/Form/ManageEvent/TabHeader.php b/CRM/Event/Form/ManageEvent/TabHeader.php index d707a72521..49ea6670ae 100644 --- a/CRM/Event/Form/ManageEvent/TabHeader.php +++ b/CRM/Event/Form/ManageEvent/TabHeader.php @@ -99,9 +99,7 @@ class CRM_Event_Form_ManageEvent_TabHeader { } // check if we're in shopping cart mode for events - $enableCart = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::EVENT_PREFERENCES_NAME, - 'enable_cart' - ); + $enableCart = Civi::settings()->get('enable_cart'); if (!$enableCart) { unset($tabs['conference']); } diff --git a/CRM/Event/Form/Participant.php b/CRM/Event/Form/Participant.php index 4c776e58a3..373da816fb 100644 --- a/CRM/Event/Form/Participant.php +++ b/CRM/Event/Form/Participant.php @@ -1623,7 +1623,7 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment if ($this->_isPaidEvent) { // fix amount for each of participants ( for bulk mode ) $eventAmount = array(); - $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings'); + $invoiceSettings = Civi::settings()->get('contribution_invoice_settings'); $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings); $totalTaxAmount = 0; @@ -1689,7 +1689,7 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment $contributionId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_ParticipantPayment', $this->_id, 'contribution_id', 'participant_id' ); - $prefixValue = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings'); + $prefixValue = Civi::settings()->get('contribution_invoice_settings'); $invoicing = CRM_Utils_Array::value('invoicing', $prefixValue); if (count($taxAmt) > 0 && (isset($invoicing) && isset($prefixValue['is_email_pdf']))) { $sendTemplateParams['isEmailPdf'] = TRUE; diff --git a/CRM/Event/Form/ParticipantView.php b/CRM/Event/Form/ParticipantView.php index 23f798838a..652f61f722 100644 --- a/CRM/Event/Form/ParticipantView.php +++ b/CRM/Event/Form/ParticipantView.php @@ -178,7 +178,7 @@ class CRM_Event_Form_ParticipantView extends CRM_Core_Form { $displayName = CRM_Contact_BAO_Contact::displayName($values[$participantID]['contact_id']); $participantCount = array(); - $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings'); + $invoiceSettings = Civi::settings()->get('contribution_invoice_settings'); $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings); $totalTaxAmount = 0; foreach ($lineItem as $k => $v) { diff --git a/CRM/Event/Form/Registration/Confirm.php b/CRM/Event/Form/Registration/Confirm.php index 0a6aff672d..8656e539b3 100644 --- a/CRM/Event/Form/Registration/Confirm.php +++ b/CRM/Event/Form/Registration/Confirm.php @@ -258,7 +258,7 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { } } - $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings'); + $invoiceSettings = Civi::settings()->get('contribution_invoice_settings'); $taxTerm = CRM_Utils_Array::value('tax_term', $invoiceSettings); $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings); if ($invoicing) { @@ -715,7 +715,7 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { } $entityTable = 'civicrm_participant'; - $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings'); + $invoiceSettings = Civi::settings()->get('contribution_invoice_settings'); $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings); $totalTaxAmount = 0; $dataArray = array(); diff --git a/CRM/Event/Form/Registration/ThankYou.php b/CRM/Event/Form/Registration/ThankYou.php index 401858d1ac..c12d6c6a57 100644 --- a/CRM/Event/Form/Registration/ThankYou.php +++ b/CRM/Event/Form/Registration/ThankYou.php @@ -96,7 +96,7 @@ class CRM_Event_Form_Registration_ThankYou extends CRM_Event_Form_Registration { } $this->assignToTemplate(); - $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings'); + $invoiceSettings = Civi::settings()->get('contribution_invoice_settings'); $taxTerm = CRM_Utils_Array::value('tax_term', $invoiceSettings); $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings); $getTaxDetails = FALSE; diff --git a/CRM/Event/Page/DashBoard.php b/CRM/Event/Page/DashBoard.php index 88041dbcb7..bcba40c66f 100644 --- a/CRM/Event/Page/DashBoard.php +++ b/CRM/Event/Page/DashBoard.php @@ -48,9 +48,7 @@ class CRM_Event_Page_DashBoard extends CRM_Core_Page { CRM_Utils_System::setTitle(ts('CiviEvent')); $eventSummary = CRM_Event_BAO_Event::getEventSummary(); - $enableCart = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::EVENT_PREFERENCES_NAME, - 'enable_cart' - ); + $enableCart = Civi::settings()->get('enable_cart'); $eventSummary['tab'] = CRM_Event_Page_ManageEvent::tabs($enableCart); $actionColumn = FALSE; diff --git a/CRM/Event/Page/EventInfo.php b/CRM/Event/Page/EventInfo.php index 5f8a1182c1..0afdebb66f 100644 --- a/CRM/Event/Page/EventInfo.php +++ b/CRM/Event/Page/EventInfo.php @@ -146,7 +146,7 @@ class CRM_Event_Page_EventInfo extends CRM_Core_Page { $labelClass = 'price_set_field-label'; } // show tax rate with amount - $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings'); + $invoiceSettings = Civi::settings()->get('contribution_invoice_settings'); $taxTerm = CRM_Utils_Array::value('tax_term', $invoiceSettings); $displayOpt = CRM_Utils_Array::value('tax_display_settings', $invoiceSettings); $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings); @@ -287,10 +287,7 @@ class CRM_Event_Page_EventInfo extends CRM_Core_Page { } // check if we're in shopping cart mode for events - $enable_cart = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::EVENT_PREFERENCES_NAME, - 'enable_cart' - ); - + $enable_cart = Civi::settings()->get('enable_cart'); if ($enable_cart) { $link = CRM_Event_Cart_BAO_EventInCart::get_registration_link($this->_id); $registerText = $link['label']; @@ -357,7 +354,7 @@ class CRM_Event_Page_EventInfo extends CRM_Core_Page { $this->assign('location', $values['location']); if (CRM_Core_Permission::check('access CiviEvent')) { - $enableCart = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::EVENT_PREFERENCES_NAME, 'enable_cart'); + $enableCart = Civi::settings()->get('enable_cart'); $this->assign('manageEventLinks', CRM_Event_Page_ManageEvent::tabs($enableCart)); } diff --git a/CRM/Event/Page/ICalendar.php b/CRM/Event/Page/ICalendar.php index 003013eded..a6a3268f75 100644 --- a/CRM/Event/Page/ICalendar.php +++ b/CRM/Event/Page/ICalendar.php @@ -75,9 +75,7 @@ class CRM_Event_Page_ICalendar extends CRM_Core_Page { } elseif ($html) { // check if we're in shopping cart mode for events - $enable_cart = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::EVENT_PREFERENCES_NAME, - 'enable_cart' - ); + $enable_cart = Civi::settings()->get('enable_cart'); if ($enable_cart) { $this->assign('registration_links', TRUE); } diff --git a/CRM/Event/Page/ManageEvent.php b/CRM/Event/Page/ManageEvent.php index dc57ff0cbd..3c58fd5e62 100644 --- a/CRM/Event/Page/ManageEvent.php +++ b/CRM/Event/Page/ManageEvent.php @@ -311,9 +311,7 @@ ORDER BY start_date desc $eventPCPS[$pcpDao->entity_id] = $pcpDao->entity_id; } // check if we're in shopping cart mode for events - $enableCart = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::EVENT_PREFERENCES_NAME, - 'enable_cart' - ); + $enableCart = Civi::settings()->get('enable_cart'); $this->assign('eventCartEnabled', $enableCart); $mapping = CRM_Utils_Array::first(CRM_Core_BAO_ActionSchedule::getMappings(array( 'id' => CRM_Event_ActionMapping::EVENT_NAME_MAPPING_ID, diff --git a/CRM/Financial/BAO/ExportFormat/CSV.php b/CRM/Financial/BAO/ExportFormat/CSV.php index 841e453018..d3c36ac0a7 100644 --- a/CRM/Financial/BAO/ExportFormat/CSV.php +++ b/CRM/Financial/BAO/ExportFormat/CSV.php @@ -174,7 +174,7 @@ class CRM_Financial_BAO_ExportFormat_CSV extends CRM_Financial_BAO_ExportFormat */ public function makeCSV($export) { // getting data from admin page - $prefixValue = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings'); + $prefixValue = Civi::settings()->get('contribution_invoice_settings'); foreach ($export as $batchId => $dao) { $financialItems = array(); diff --git a/CRM/Financial/BAO/FinancialItem.php b/CRM/Financial/BAO/FinancialItem.php index cf14e860d9..5a62341b3c 100644 --- a/CRM/Financial/BAO/FinancialItem.php +++ b/CRM/Financial/BAO/FinancialItem.php @@ -101,7 +101,7 @@ class CRM_Financial_BAO_FinancialItem extends CRM_Financial_DAO_FinancialItem { ); if ($taxTrxnID) { - $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings'); + $invoiceSettings = Civi::settings()->get('contribution_invoice_settings'); $taxTerm = CRM_Utils_Array::value('tax_term', $invoiceSettings); $params['amount'] = $lineItem->tax_amount; $params['description'] = $taxTerm; @@ -250,7 +250,7 @@ class CRM_Financial_BAO_FinancialItem extends CRM_Financial_DAO_FinancialItem { return FALSE; } - $allowPermDelete = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'allowPermDeleteFinancial'); + $allowPermDelete = Civi::settings()->get('allowPermDeleteFinancial'); if (!$allowPermDelete) { $sql = 'SELECT DISTINCT(cc.id), cc.display_name FROM civicrm_contact cc diff --git a/CRM/Financial/BAO/FinancialType.php b/CRM/Financial/BAO/FinancialType.php index 4c3c5ce833..1b248bfa92 100644 --- a/CRM/Financial/BAO/FinancialType.php +++ b/CRM/Financial/BAO/FinancialType.php @@ -402,9 +402,7 @@ class CRM_Financial_BAO_FinancialType extends CRM_Financial_DAO_FinancialType { if (array_key_exists('acl_financial_type', self::$_statusACLFt)) { return self::$_statusACLFt['acl_financial_type']; } - $contributeSettings = CRM_Core_BAO_Setting::getItem( - CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings' - ); + $contributeSettings = Civi::settings()->get('contribution_invoice_settings'); self::$_statusACLFt['acl_financial_type'] = FALSE; if (CRM_Utils_Array::value('acl_financial_type', $contributeSettings)) { self::$_statusACLFt['acl_financial_type'] = TRUE; diff --git a/CRM/Mailing/BAO/Mailing.php b/CRM/Mailing/BAO/Mailing.php index 7b2b0b910f..c88f386ade 100644 --- a/CRM/Mailing/BAO/Mailing.php +++ b/CRM/Mailing/BAO/Mailing.php @@ -1775,7 +1775,7 @@ ORDER BY civicrm_email.is_bulkmail DESC $errors['body'] = ts('Field "body_html" or "body_text" is required.'); } - if (!CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, 'disable_mandatory_tokens_check')) { + if (!Civi::settings()->get('disable_mandatory_tokens_check')) { $header = $mailing->header_id && $mailing->header_id != 'null' ? CRM_Mailing_BAO_Component::findById($mailing->header_id) : NULL; $footer = $mailing->footer_id && $mailing->footer_id != 'null' ? CRM_Mailing_BAO_Component::findById($mailing->footer_id) : NULL; foreach (array('body_html', 'body_text') as $field) { @@ -1830,7 +1830,7 @@ ORDER BY civicrm_email.is_bulkmail DESC */ public static function getMailingHash($id) { $hash = NULL; - if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, 'hash_mailing_url')) { + if (Civi::settings()->get('hash_mailing_url')) { $hash = CRM_Core_DAO::getFieldValue('CRM_Mailing_BAO_Mailing', $id, 'hash', 'id'); } return $hash; diff --git a/CRM/Mailing/BAO/MailingJob.php b/CRM/Mailing/BAO/MailingJob.php index 998e046a61..e6023f77a8 100644 --- a/CRM/Mailing/BAO/MailingJob.php +++ b/CRM/Mailing/BAO/MailingJob.php @@ -926,12 +926,7 @@ AND status IN ( 'Scheduled', 'Running', 'Paused' ) } if ($writeActivity === NULL) { - $writeActivity = CRM_Core_BAO_Setting::getItem( - CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, - 'write_activity_record', - NULL, - TRUE - ); + $writeActivity = Civi::settings()->get('write_activity_record'); } if (!$writeActivity) { diff --git a/CRM/Mailing/Info.php b/CRM/Mailing/Info.php index 2bc5c972be..6702e27544 100644 --- a/CRM/Mailing/Info.php +++ b/CRM/Mailing/Info.php @@ -165,8 +165,8 @@ class CRM_Mailing_Info extends CRM_Core_Component_Info { 'mailTokens' => $mailTokens['values'], 'contactid' => $contactID, 'requiredTokens' => CRM_Utils_Token::getRequiredTokens(), - 'enableReplyTo' => (int) CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, 'replyTo'), - 'disableMandatoryTokensCheck' => (int) CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, 'disable_mandatory_tokens_check'), + 'enableReplyTo' => (int) Civi::settings()->get('replyTo'), + 'disableMandatoryTokensCheck' => (int) Civi::settings()->get('disable_mandatory_tokens_check'), 'fromAddress' => $fromAddress['values'], 'defaultTestEmail' => civicrm_api3('Contact', 'getvalue', array( 'id' => 'user_contact_id', @@ -206,11 +206,7 @@ class CRM_Mailing_Info extends CRM_Core_Component_Info { return FALSE; } - $enableWorkflow = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, - 'civimail_workflow', - NULL, - FALSE - ); + $enableWorkflow = Civi::settings()->get('civimail_workflow'); return ($enableWorkflow && $config->userSystem->is_drupal diff --git a/CRM/Mailing/Page/View.php b/CRM/Mailing/Page/View.php index 49c75879a1..411cbd0c0f 100644 --- a/CRM/Mailing/Page/View.php +++ b/CRM/Mailing/Page/View.php @@ -99,7 +99,7 @@ class CRM_Mailing_Page_View extends CRM_Core_Page { } // mailing key check - if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, 'hash_mailing_url')) { + if (Civi::settings()->get('hash_mailing_url')) { $this->_mailing = new CRM_Mailing_BAO_Mailing(); if (!is_numeric($this->_mailingID)) { diff --git a/CRM/Member/Form/Membership.php b/CRM/Member/Form/Membership.php index 51cf19ad8f..cd312ff947 100644 --- a/CRM/Member/Form/Membership.php +++ b/CRM/Member/Form/Membership.php @@ -411,7 +411,7 @@ class CRM_Member_Form_Membership extends CRM_Member_Form { $this->assign('taxRates', json_encode(CRM_Core_PseudoConstant::getTaxRates())); $this->assign('currency', CRM_Core_Config::singleton()->defaultCurrencySymbol); - $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings'); + $invoiceSettings = Civi::settings()->get('contribution_invoice_settings'); $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings); if (isset($invoicing)) { $this->assign('taxTerm', CRM_Utils_Array::value('tax_term', $invoiceSettings)); @@ -719,8 +719,7 @@ class CRM_Member_Form_Membership extends CRM_Member_Form { $this->addFormRule(array('CRM_Member_Form_Membership', 'formRule'), $this); - $this->assign('outBound_option', CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, - 'mailing_backend')); + $this->assign('outBound_option', Civi::settings()->get('mailing_backend')); parent::buildQuickForm(); } @@ -1082,7 +1081,7 @@ class CRM_Member_Form_Membership extends CRM_Member_Form { $template = CRM_Core_Smarty::singleton(); $taxAmt = $template->get_template_vars('dataArray'); $eventTaxAmt = $template->get_template_vars('totalTaxAmount'); - $prefixValue = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings'); + $prefixValue = Civi::settings()->get('contribution_invoice_settings'); $invoicing = CRM_Utils_Array::value('invoicing', $prefixValue); if ((!empty($taxAmt) || isset($eventTaxAmt)) && (isset($invoicing) && isset($prefixValue['is_email_pdf']))) { $isEmailPdf = TRUE; @@ -1653,7 +1652,7 @@ class CRM_Member_Form_Membership extends CRM_Member_Form { } if (!empty($lineItem[$this->_priceSetId])) { - $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings'); + $invoiceSettings = Civi::settings()->get('contribution_invoice_settings'); $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings); $taxAmount = FALSE; $totalTaxAmount = 0; diff --git a/CRM/Member/Form/MembershipRenewal.php b/CRM/Member/Form/MembershipRenewal.php index 2db99745c8..3945daf1cb 100644 --- a/CRM/Member/Form/MembershipRenewal.php +++ b/CRM/Member/Form/MembershipRenewal.php @@ -261,7 +261,7 @@ class CRM_Member_Form_MembershipRenewal extends CRM_Member_Form { $taxRates = CRM_Core_PseudoConstant::getTaxRates(); $taxRate = CRM_Utils_Array::value($allMemberships[$defaults['membership_type_id']]['financial_type_id'], $taxRates); - $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings'); + $invoiceSettings = Civi::settings()->get('contribution_invoice_settings'); // auto renew options if enabled for the membership $options = CRM_Core_SelectValues::memberAutoRenew(); @@ -398,9 +398,7 @@ class CRM_Member_Form_MembershipRenewal extends CRM_Member_Form { // The member form uses emailExists. Assigning both while we transition / synchronise. $this->assign('emailExists', $this->_contributorEmail); - $mailingInfo = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, - 'mailing_backend' - ); + $mailingInfo = Civi::settings()->get('mailing_backend'); $this->assign('outBound_option', $mailingInfo['outBound_option']); if (CRM_Core_DAO::getFieldValue('CRM_Member_DAO_Membership', $this->_id, 'contribution_recur_id')) { diff --git a/CRM/Member/Page/UserDashboard.php b/CRM/Member/Page/UserDashboard.php index b416da1b8a..8cdcd78e79 100644 --- a/CRM/Member/Page/UserDashboard.php +++ b/CRM/Member/Page/UserDashboard.php @@ -68,9 +68,7 @@ class CRM_Member_Page_UserDashboard extends CRM_Contact_Page_View_UserDashBoard $membership[$dao->id]['renewPageId'] = CRM_Member_BAO_Membership::getContributionPageId($dao->id); if (!$membership[$dao->id]['renewPageId']) { // Membership payment was not done via online contribution page or free membership. Check for default membership renewal page from CiviMember Settings - $defaultRenewPageId = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MEMBER_PREFERENCES_NAME, - 'default_renewal_contribution_page' - ); + $defaultRenewPageId = Civi::settings()->get('default_renewal_contribution_page'); if ($defaultRenewPageId) { //CRM-14831 - check if membership type is present in contrib page $memBlock = CRM_Member_BAO_Membership::getMembershipBlock($defaultRenewPageId); diff --git a/CRM/Pledge/Form/Pledge.php b/CRM/Pledge/Form/Pledge.php index 354ba2e0da..6a4456ed60 100644 --- a/CRM/Pledge/Form/Pledge.php +++ b/CRM/Pledge/Form/Pledge.php @@ -396,9 +396,7 @@ class CRM_Pledge_Form_Pledge extends CRM_Core_Form { array('' => ts('- select -')) + $pledgePages ); - $mailingInfo = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, - 'mailing_backend' - ); + $mailingInfo = Civi::settings()->get('mailing_backend'); $this->assign('outBound_option', $mailingInfo['outBound_option']); // build custom data diff --git a/CRM/Price/BAO/LineItem.php b/CRM/Price/BAO/LineItem.php index 0e8dccce32..c793357db2 100644 --- a/CRM/Price/BAO/LineItem.php +++ b/CRM/Price/BAO/LineItem.php @@ -219,7 +219,7 @@ AND li.entity_id = {$entityId} ); $getTaxDetails = FALSE; - $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings'); + $invoiceSettings = Civi::settings()->get('contribution_invoice_settings'); $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings); if ($overrideWhereClause) { $whereClause = $overrideWhereClause; diff --git a/CRM/Price/BAO/PriceField.php b/CRM/Price/BAO/PriceField.php index b15df0b3b4..75fcf0b610 100644 --- a/CRM/Price/BAO/PriceField.php +++ b/CRM/Price/BAO/PriceField.php @@ -298,7 +298,7 @@ class CRM_Price_BAO_PriceField extends CRM_Price_DAO_PriceField { //use value field. $valueFieldName = 'amount'; $seperator = '|'; - $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings'); + $invoiceSettings = Civi::settings()->get('contribution_invoice_settings'); $taxTerm = CRM_Utils_Array::value('tax_term', $invoiceSettings); $displayOpt = CRM_Utils_Array::value('tax_display_settings', $invoiceSettings); $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings); diff --git a/CRM/Price/Page/Field.php b/CRM/Price/Page/Field.php index 85b3a27fb4..34b4ba6d25 100644 --- a/CRM/Price/Page/Field.php +++ b/CRM/Price/Page/Field.php @@ -128,7 +128,7 @@ class CRM_Price_Page_Field extends CRM_Core_Page { $priceFieldBAO->find(); // display taxTerm for priceFields - $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings'); + $invoiceSettings = Civi::settings()->get('contribution_invoice_settings'); $taxTerm = CRM_Utils_Array::value('tax_term', $invoiceSettings); $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings); $getTaxDetails = FALSE; diff --git a/CRM/Price/Page/Option.php b/CRM/Price/Page/Option.php index 5113766055..5d2a8bbca3 100644 --- a/CRM/Price/Page/Option.php +++ b/CRM/Price/Page/Option.php @@ -137,7 +137,7 @@ class CRM_Price_Page_Option extends CRM_Core_Page { $financialType = CRM_Contribute_PseudoConstant::financialType(); $taxRate = CRM_Core_PseudoConstant::getTaxRates(); // display taxTerm for priceFields - $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings'); + $invoiceSettings = Civi::settings()->get('contribution_invoice_settings'); $taxTerm = CRM_Utils_Array::value('tax_term', $invoiceSettings); $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings); $getTaxDetails = FALSE; diff --git a/CRM/Upgrade/Incremental/php/FourSeven.php b/CRM/Upgrade/Incremental/php/FourSeven.php index 06734d693f..d9c9b411a2 100644 --- a/CRM/Upgrade/Incremental/php/FourSeven.php +++ b/CRM/Upgrade/Incremental/php/FourSeven.php @@ -130,7 +130,7 @@ class CRM_Upgrade_Incremental_php_FourSeven extends CRM_Upgrade_Incremental_Base * @return int */ public static function updateWysiwyg() { - $editorID = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'editor_id'); + $editorID = Civi::settings()->get('editor_id'); // 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"; diff --git a/CRM/Upgrade/Snapshot/V4p2/Price/BAO/Set.php b/CRM/Upgrade/Snapshot/V4p2/Price/BAO/Set.php index 7dfdd90ef1..dedae1bb73 100644 --- a/CRM/Upgrade/Snapshot/V4p2/Price/BAO/Set.php +++ b/CRM/Upgrade/Snapshot/V4p2/Price/BAO/Set.php @@ -1123,10 +1123,7 @@ GROUP BY mt.member_of_contact_id"; * @return object */ public static function eventPriceSetDomainID() { - return CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MULTISITE_PREFERENCES_NAME, - 'event_price_set_domain_id', - NULL, FALSE - ); + return Civi::settings()->get('event_price_set_domain_id'); } /** diff --git a/CRM/Utils/Address.php b/CRM/Utils/Address.php index 6656f34e25..62c7a31b49 100644 --- a/CRM/Utils/Address.php +++ b/CRM/Utils/Address.php @@ -67,11 +67,11 @@ class CRM_Utils_Address { static $config = NULL; if (!$format) { - $format = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'address_format'); + $format = Civi::settings()->get('address_format'); } if ($mailing) { - $format = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'mailing_format'); + $format = Civi::settings()->get('mailing_format'); } $formatted = $format; diff --git a/CRM/Utils/Address/USPS.php b/CRM/Utils/Address/USPS.php index 74fab74f9c..2f26dd8f9c 100644 --- a/CRM/Utils/Address/USPS.php +++ b/CRM/Utils/Address/USPS.php @@ -52,12 +52,8 @@ class CRM_Utils_Address_USPS { return FALSE; } - $userID = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::ADDRESS_STANDARDIZATION_PREFERENCES_NAME, - 'address_standardization_userid' - ); - $url = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::ADDRESS_STANDARDIZATION_PREFERENCES_NAME, - 'address_standardization_url' - ); + $userID = Civi::settings()->get('address_standardization_userid'); + $url = Civi::settings()->get('address_standardization_url'); if (empty($userID) || empty($url) diff --git a/CRM/Utils/Check/Env.php b/CRM/Utils/Check/Env.php index 9e1aaaef48..2efc00c848 100644 --- a/CRM/Utils/Check/Env.php +++ b/CRM/Utils/Check/Env.php @@ -145,7 +145,7 @@ class CRM_Utils_Check_Env { public function checkOutboundMail() { $messages = array(); - $mailingInfo = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, 'mailing_backend'); + $mailingInfo = Civi::settings()->get('mailing_backend'); if (($mailingInfo['outBound_option'] == CRM_Mailing_Config::OUTBOUND_OPTION_REDIRECT_TO_DB || (defined('CIVICRM_MAIL_LOG') && CIVICRM_MAIL_LOG) || $mailingInfo['outBound_option'] == CRM_Mailing_Config::OUTBOUND_OPTION_DISABLED diff --git a/CRM/Utils/Date.php b/CRM/Utils/Date.php index 5276f7c631..892ad15fb8 100644 --- a/CRM/Utils/Date.php +++ b/CRM/Utils/Date.php @@ -179,7 +179,7 @@ class CRM_Utils_Date { static $days = array(); if (!$days) { // First day of the week - $firstDay = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::LOCALIZATION_PREFERENCES_NAME, 'weekBegins', NULL, 0); + $firstDay = Civi::settings()->get('weekBegins'); // set LC_TIME and build the arrays from locale-provided names // June 1st, 1970 was a Monday @@ -208,7 +208,7 @@ class CRM_Utils_Date { static $days = array(); if (!$days) { // First day of the week - $firstDay = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::LOCALIZATION_PREFERENCES_NAME, 'weekBegins', NULL, 0); + $firstDay = Civi::settings()->get('weekBegins'); // set LC_TIME and build the arrays from locale-provided names // June 1st, 1970 was a Monday @@ -1487,7 +1487,7 @@ class CRM_Utils_Date { break; case 'week': - $weekFirst = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::LOCALIZATION_PREFERENCES_NAME, 'weekBegins', NULL, 0); + $weekFirst = Civi::settings()->get('weekBegins'); $thisDay = $now['wday']; if ($weekFirst > $thisDay) { $diffDay = $thisDay - $weekFirst + 7; diff --git a/CRM/Utils/HttpClient.php b/CRM/Utils/HttpClient.php index 790fb37dd6..ee4cb5171f 100644 --- a/CRM/Utils/HttpClient.php +++ b/CRM/Utils/HttpClient.php @@ -198,7 +198,7 @@ class CRM_Utils_HttpClient { */ protected function createCurl($remoteFile) { $caConfig = CA_Config_Curl::probe(array( - 'verify_peer' => (bool) CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'verifySSL'), + 'verify_peer' => (bool) Civi::settings()->get('verifySSL'), )); $ch = curl_init(); diff --git a/CRM/Utils/Mail.php b/CRM/Utils/Mail.php index 6f096eafbc..f80bcb45a8 100644 --- a/CRM/Utils/Mail.php +++ b/CRM/Utils/Mail.php @@ -43,9 +43,7 @@ class CRM_Utils_Mail { * @return Mail */ public static function createMailer() { - $mailingInfo = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, - 'mailing_backend' - ); + $mailingInfo = Civi::settings()->get('mailing_backend'); if ($mailingInfo['outBound_option'] == CRM_Mailing_Config::OUTBOUND_OPTION_REDIRECT_TO_DB || (defined('CIVICRM_MAILER_SPOOL') && CIVICRM_MAILER_SPOOL) @@ -375,9 +373,7 @@ class CRM_Utils_Mail { * TRUE if valid outBound email configuration found, false otherwise. */ public static function validOutBoundMail() { - $mailingInfo = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, - 'mailing_backend' - ); + $mailingInfo = Civi::settings()->get('mailing_backend'); if ($mailingInfo['outBound_option'] == CRM_Mailing_Config::OUTBOUND_OPTION_MAIL) { return TRUE; } diff --git a/CRM/Utils/PDF/Label.php b/CRM/Utils/PDF/Label.php index 4dd4ffff00..78c4ae422c 100644 --- a/CRM/Utils/PDF/Label.php +++ b/CRM/Utils/PDF/Label.php @@ -269,7 +269,7 @@ class CRM_Utils_PDF_Label extends TCPDF { // Check to see if we have any additional fonts to add. You can specify more fonts in // civicrm.settings.php via: $config['CiviCRM Preferences']['additional_fonts'] // CRM-13307 - $additionalFonts = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'additional_fonts'); + $additionalFonts = Civi::settings()->get('additional_fonts'); if (is_array($additionalFonts)) { $fontLabel = array_merge($fontLabel, $additionalFonts); } diff --git a/CRM/Utils/QueryFormatter.php b/CRM/Utils/QueryFormatter.php index e4d8af9e9f..3fc17410b1 100644 --- a/CRM/Utils/QueryFormatter.php +++ b/CRM/Utils/QueryFormatter.php @@ -81,14 +81,14 @@ class CRM_Utils_QueryFormatter { */ public static function singleton($fresh = FALSE) { if ($fresh || self::$singleton === NULL) { - $mode = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SEARCH_PREFERENCES_NAME, 'fts_query_mode', NULL, self::MODE_NONE); + $mode = Civi::settings()->get('fts_query_mode'); self::$singleton = new CRM_Utils_QueryFormatter($mode); } return self::$singleton; } /** - * @var string + * @var string * eg MODE_NONE */ protected $mode; diff --git a/CRM/Utils/System.php b/CRM/Utils/System.php index 2ca8294c62..d14f025945 100644 --- a/CRM/Utils/System.php +++ b/CRM/Utils/System.php @@ -1196,7 +1196,7 @@ class CRM_Utils_System { $config = CRM_Core_Config::singleton(); $req_headers = self::getRequestHeaders(); // FIXME: Shouldn't the X-Forwarded-Proto check be part of CRM_Utils_System::isSSL()? - if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'enableSSL') && + if (Civi::settings()->get('enableSSL') && !self::isSSL() && strtolower(CRM_Utils_Array::value('X_FORWARDED_PROTO', $req_headers)) != 'https' ) { @@ -1823,7 +1823,7 @@ class CRM_Utils_System { * @return string */ public static function getSiteID() { - $sid = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'site_id'); + $sid = Civi::settings()->get('site_id'); if (!$sid) { $config = CRM_Core_Config::singleton(); $sid = md5('sid_' . (defined('CIVICRM_SITE_KEY') ? CIVICRM_SITE_KEY : '') . '_' . $config->userFrameworkBaseURL); diff --git a/CRM/Utils/System/WordPress.php b/CRM/Utils/System/WordPress.php index dea048da3b..0b815191fe 100644 --- a/CRM/Utils/System/WordPress.php +++ b/CRM/Utils/System/WordPress.php @@ -381,7 +381,7 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base { if (!$cmsRootPath) { CRM_Core_Error::fatal("Could not find the install directory for WordPress"); } - $path = CRM_Core_BAO_Setting::getItem('CiviCRM Preferences', 'wpLoadPhp'); + $path = Civi::settings()->get('wpLoadPhp'); if (!empty($path)) { require_once $path; } diff --git a/CRM/Utils/VersionCheck.php b/CRM/Utils/VersionCheck.php index 583c5d1153..eff22b5506 100644 --- a/CRM/Utils/VersionCheck.php +++ b/CRM/Utils/VersionCheck.php @@ -104,7 +104,7 @@ class CRM_Utils_VersionCheck { $this->localMajorVersion = $this->getMajorVersion($this->localVersion); } // Populate $versionInfo - if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'versionCheck', NULL, 1)) { + if (Civi::settings()->get('versionCheck')) { // Use cached data if available and not stale if (!$this->readCacheFile()) { // Collect stats for pingback diff --git a/settings/Event.setting.php b/settings/Event.setting.php index bc0f785991..d7358097ef 100644 --- a/settings/Event.setting.php +++ b/settings/Event.setting.php @@ -50,4 +50,19 @@ return array( 'description' => "WRITE ME", 'help_text' => 'WRITE ME', ), + 'show_events' => array( + 'name' => 'show_events', + 'group_name' => 'Event Preferences', + 'group' => 'event', + 'type' => 'Integer', + 'quick_form_type' => 'Element', + 'default' => 10, + 'add' => '4.5', + 'title' => 'Dashboard entries', + 'html_type' => 'select', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => "Configure how many events should be shown on the dashboard. This overrides the default value of 10 entries.", + 'help_text' => NULL, + ), ); -- 2.25.1