From b7aba0613238f76d2ce870fbb18aa68a4b14c385 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Mon, 27 May 2013 20:06:47 -0700 Subject: [PATCH] Add versionAlert setting CRM-12701 --- CRM/Admin/Form/Setting/Miscellaneous.php | 2 +- CRM/Utils/VersionCheck.php | 3 ++- settings/Core.setting.php | 18 +++++++++++++++++- .../CRM/Admin/Form/Setting/Miscellaneous.tpl | 6 +++++- 4 files changed, 25 insertions(+), 4 deletions(-) diff --git a/CRM/Admin/Form/Setting/Miscellaneous.php b/CRM/Admin/Form/Setting/Miscellaneous.php index e15c20636e..c5448037ca 100644 --- a/CRM/Admin/Form/Setting/Miscellaneous.php +++ b/CRM/Admin/Form/Setting/Miscellaneous.php @@ -42,6 +42,7 @@ class CRM_Admin_Form_Setting_Miscellaneous extends CRM_Admin_Form_Setting { protected $_settings = array( 'max_attachments' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'contact_undelete' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, + 'versionAlert' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'versionCheck' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'maxFileSize' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'doNotAttachPDFReceipt' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, @@ -56,7 +57,6 @@ class CRM_Admin_Form_Setting_Miscellaneous extends CRM_Admin_Form_Setting { public function buildQuickForm() { CRM_Utils_System::setTitle(ts('Settings - Undelete, Logging and ReCAPTCHA')); - // also check if we can enable triggers $validTriggerPermission = CRM_Core_DAO::checkTriggerViewPermission(FALSE); diff --git a/CRM/Utils/VersionCheck.php b/CRM/Utils/VersionCheck.php index 0f6404d756..f94487cdda 100644 --- a/CRM/Utils/VersionCheck.php +++ b/CRM/Utils/VersionCheck.php @@ -177,7 +177,8 @@ class CRM_Utils_VersionCheck { * Show the message once a day */ public function versionAlert() { - if (CRM_Core_Permission::check('administer CiviCRM') && $this->newerVersion()) { + if (CRM_Core_Permission::check('administer CiviCRM') && $this->newerVersion() + && CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'versionAlert', NULL, TRUE)) { $session = CRM_Core_Session::singleton(); if ($session->timer('version_alert', 24 * 60 * 60)) { $msg = ts('A newer version of CiviCRM is available: %1', array(1 => $this->latestVersion)) diff --git a/settings/Core.setting.php b/settings/Core.setting.php index 8e7a982e7e..d8f06a2765 100644 --- a/settings/Core.setting.php +++ b/settings/Core.setting.php @@ -323,6 +323,22 @@ return array ( 'description' => 'If enabled, deleted contacts will be moved to trash (instead of being destroyed). Users with the proper permission are able to search for the deleted contacts and restore them (or delete permanently).', 'help_text' => null, ), + 'versionAlert' => array( + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'versionAlert', + 'prefetch' => 1, + 'config_only'=> 1, + 'type' => 'Boolean', + 'quick_form_type' => 'YesNo', + 'default' => 1, + 'add' => '4.3', + 'title' => 'New Version Alerts', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'Displays an on-screen alert to users with "Administer CiviCRM" permissions when a new version of CiviCRM is available. This setting will only work if the "Version Check & Statistics Reporting" setting is enabled.', + 'help_text' => null, + ), 'versionCheck' => array( 'group_name' => 'CiviCRM Preferences', 'group' => 'core', @@ -546,4 +562,4 @@ When enabled, statistics about your CiviCRM installation are reported anonymousl 'description' => 'If disabled, backend HTTPS services will allow unverified, insecure connections', 'help_text' => 'Unless you are absolutely unable to configure your server to check the SSL certificate of the remote server you should leave this set to Yes', ), -); \ No newline at end of file +); diff --git a/templates/CRM/Admin/Form/Setting/Miscellaneous.tpl b/templates/CRM/Admin/Form/Setting/Miscellaneous.tpl index 086deaca68..8e397e3ec3 100644 --- a/templates/CRM/Admin/Form/Setting/Miscellaneous.tpl +++ b/templates/CRM/Admin/Form/Setting/Miscellaneous.tpl @@ -73,10 +73,14 @@

{ts 1="http://code.google.com/p/wkhtmltopdf/"}wkhtmltopdf is an alternative utility for generating PDF's which may provide better performance especially if you are generating a large number of PDF letters or receipts. Your system administrator will need to download and install this utility, and enter the executable path here.{/ts}

+ + {$form.versionAlert.label} + {$form.versionAlert.html}
+

{ts}Displays an on-screen alert to users with "Administer CiviCRM" permissions when a new version of CiviCRM is available. This setting will only work if the "Version Check & Statistics Reporting" setting is enabled.{/ts}

+ {$form.versionCheck.label} {$form.versionCheck.html}
-

{ts}If enabled, CiviCRM automatically checks availablity of a newer version of the software. New version alerts will be displayed on the main CiviCRM Administration page.{/ts}

{ts}When enabled, statistics about your CiviCRM installation are reported anonymously to the CiviCRM team to assist in prioritizing ongoing development efforts. The following information is gathered: CiviCRM version, versions of PHP, MySQL and framework (Drupal/Joomla/standalone), and default language. Counts (but no actual data) of the following record types are reported: contacts, activities, cases, relationships, contributions, contribution pages, contribution products, contribution widgets, discounts, price sets, profiles, events, participants, tell-a-friend pages, grants, mailings, memberships, membership blocks, pledges, pledge blocks and active payment processor types.{/ts}

-- 2.25.1