From 89595c9276e0cd7eb5d0a7ff85929afec19658b0 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Thu, 20 Aug 2015 03:51:39 -0700 Subject: [PATCH] CRM_Core_BAO_Setting::getItem() - Fix calls which use deprecated parameters --- CRM/Admin/Page/AJAX.php | 2 +- CRM/Case/Page/AJAX.php | 2 +- CRM/Contact/BAO/Contact.php | 2 +- CRM/Contact/Form/Search/Criteria.php | 2 +- CRM/Contact/Form/Task/Delete.php | 2 +- CRM/Contact/Page/AJAX.php | 6 +++--- CRM/Core/BAO/MailSettings.php | 6 +----- api/v3/Contact.php | 2 +- api/v3/Generic/Getlist.php | 2 +- settings/Mailing.setting.php | 14 ++++++++++++++ 10 files changed, 25 insertions(+), 15 deletions(-) diff --git a/CRM/Admin/Page/AJAX.php b/CRM/Admin/Page/AJAX.php index 64cfb8e34b..ffa7699322 100644 --- a/CRM/Admin/Page/AJAX.php +++ b/CRM/Admin/Page/AJAX.php @@ -248,7 +248,7 @@ class CRM_Admin_Page_AJAX { public static function mergeTagList() { $name = CRM_Utils_Type::escape($_GET['term'], 'String'); $fromId = CRM_Utils_Type::escape($_GET['fromId'], 'Integer'); - $limit = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'search_autocomplete_count', NULL, 10); + $limit = Civi::settings()->get('search_autocomplete_count'); // build used-for clause to be used in main query $usedForTagA = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Tag', $fromId, 'used_for'); diff --git a/CRM/Case/Page/AJAX.php b/CRM/Case/Page/AJAX.php index bfb3fe71d9..f0a9e4667f 100644 --- a/CRM/Case/Page/AJAX.php +++ b/CRM/Case/Page/AJAX.php @@ -42,7 +42,7 @@ class CRM_Case_Page_AJAX { */ public static function unclosedCases() { $params = array( - 'limit' => CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'search_autocomplete_count', NULL, 10), + 'limit' => Civi::settings()->get('search_autocomplete_count'), 'sort_name' => CRM_Utils_Type::escape(CRM_Utils_Array::value('term', $_GET, ''), 'String'), ); diff --git a/CRM/Contact/BAO/Contact.php b/CRM/Contact/BAO/Contact.php index d0c3863c1b..1afebccd34 100644 --- a/CRM/Contact/BAO/Contact.php +++ b/CRM/Contact/BAO/Contact.php @@ -782,7 +782,7 @@ WHERE civicrm_contact.id = " . CRM_Utils_Type::escape($id, 'Integer'); return FALSE; } // If trash is disabled in system settings then we always skip - if (!CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'contact_undelete', NULL, 1)) { + if (!Civi::settings()->get('contact_undelete')) { $skipUndelete = TRUE; } diff --git a/CRM/Contact/Form/Search/Criteria.php b/CRM/Contact/Form/Search/Criteria.php index 2440fe57be..f34dcee028 100644 --- a/CRM/Contact/Form/Search/Criteria.php +++ b/CRM/Contact/Form/Search/Criteria.php @@ -121,7 +121,7 @@ class CRM_Contact_Form_Search_Criteria { //added external ID $form->addElement('text', 'external_identifier', ts('External ID'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'external_identifier')); - if (CRM_Core_Permission::check('access deleted contacts') and CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'contact_undelete', NULL)) { + if (CRM_Core_Permission::check('access deleted contacts') and Civi::settings()->get('contact_undelete')) { $form->add('checkbox', 'deleted_contacts', ts('Search in Trash') . '
' . ts('(deleted contacts)')); } diff --git a/CRM/Contact/Form/Task/Delete.php b/CRM/Contact/Form/Task/Delete.php index 1603f81180..a8dfc08aef 100644 --- a/CRM/Contact/Form/Task/Delete.php +++ b/CRM/Contact/Form/Task/Delete.php @@ -74,7 +74,7 @@ class CRM_Contact_Form_Task_Delete extends CRM_Contact_Form_Task { CRM_Core_Error::fatal(ts('You do not have permission to delete this contact.')); } - $this->assign('trash', CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'contact_undelete', NULL) and !$this->_skipUndelete); + $this->assign('trash', Civi::settings()->get('contact_undelete') and !$this->_skipUndelete); $this->assign('restore', $this->_restore); if ($this->_restore) { diff --git a/CRM/Contact/Page/AJAX.php b/CRM/Contact/Page/AJAX.php index 9bcbc2f932..4fd4fdc2bd 100644 --- a/CRM/Contact/Page/AJAX.php +++ b/CRM/Contact/Page/AJAX.php @@ -83,7 +83,7 @@ class CRM_Contact_Page_AJAX { $return = array_unique(array_merge(array('sort_name'), $list)); - $limit = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'search_autocomplete_count', NULL, 10); + $limit = Civi::settings()->get('search_autocomplete_count'); $params = array('offset' => 0, 'rowCount' => $limit, 'version' => 3); foreach ($return as $fld) { @@ -158,7 +158,7 @@ class CRM_Contact_Page_AJAX { public static function getPCPList() { $name = CRM_Utils_Array::value('term', $_GET); $name = CRM_Utils_Type::escape($name, 'String'); - $limit = $max = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'search_autocomplete_count', NULL, 10); + $limit = $max = Civi::settings()->get('search_autocomplete_count'); $where = ' AND pcp.page_id = cp.id AND pcp.contact_id = cc.id'; @@ -403,7 +403,7 @@ class CRM_Contact_Page_AJAX { if ($queryString) { $offset = CRM_Utils_Array::value('offset', $_GET, 0); - $rowCount = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'search_autocomplete_count', NULL, 10); + $rowCount = Civi::settings()->get('search_autocomplete_count'); $offset = CRM_Utils_Type::escape($offset, 'Int'); diff --git a/CRM/Core/BAO/MailSettings.php b/CRM/Core/BAO/MailSettings.php index c7538d58d6..4644b79fe8 100644 --- a/CRM/Core/BAO/MailSettings.php +++ b/CRM/Core/BAO/MailSettings.php @@ -100,11 +100,7 @@ class CRM_Core_BAO_MailSettings extends CRM_Core_DAO_MailSettings { * default include message ID */ public static function includeMessageId() { - return CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, - 'include_message_id', - NULL, - FALSE - ); + return Civi::settings()->get('include_message_id'); } /** diff --git a/api/v3/Contact.php b/api/v3/Contact.php index ce54e09101..ba2f3dedbd 100644 --- a/api/v3/Contact.php +++ b/api/v3/Contact.php @@ -756,7 +756,7 @@ function civicrm_api3_contact_getquick($params) { } $from = implode(' ', $from); $limit = (int) CRM_Utils_Array::value('limit', $params); - $limit = $limit > 0 ? $limit : CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SEARCH_PREFERENCES_NAME, 'search_autocomplete_count', NULL, 10); + $limit = $limit > 0 ? $limit : Civi::settings()->get('search_autocomplete_count'); // add acl clause here list($aclFrom, $aclWhere) = CRM_Contact_BAO_Contact_Permission::cacheClause('cc'); diff --git a/api/v3/Generic/Getlist.php b/api/v3/Generic/Getlist.php index 9143c99ff1..20134c1578 100644 --- a/api/v3/Generic/Getlist.php +++ b/api/v3/Generic/Getlist.php @@ -105,7 +105,7 @@ function _civicrm_api3_generic_getList_defaults($entity, &$request, $apiDefaults $defaults['description_field'][] = $field; } } - $resultsPerPage = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'search_autocomplete_count', NULL, 10); + $resultsPerPage = Civi::settings()->get('search_autocomplete_count'); if (isset($request['params']) && isset($apiDefaults['params'])) { $request['params'] += $apiDefaults['params']; } diff --git a/settings/Mailing.setting.php b/settings/Mailing.setting.php index 30a8bc973d..ccab6e9467 100644 --- a/settings/Mailing.setting.php +++ b/settings/Mailing.setting.php @@ -192,4 +192,18 @@ return array( 'description' => 'If enabled, CiviMail will deliver a copy of the email to each bulk email listed for the contact.', 'help_text' => NULL, ), + 'include_message_id' => array( + 'group_name' => 'Mailing Preferences', + 'group' => 'mailing', + 'name' => 'include_message_id', + 'type' => 'Integer', + 'html_type' => 'checkbox', + 'default' => FALSE, + 'add' => '4.5', + 'title' => 'Enable CiviMail to generate Message-ID header', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => '', + 'help_text' => NULL, + ), ); -- 2.25.1