From 6098a966f0a097b32a3f07d1bb608c23249d6642 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Wed, 25 Feb 2015 12:49:58 -0800 Subject: [PATCH] CRM-15943 - Move replyTo option from $config to a setting. Note: I tried using the prefetch/config_only options, but they didn't seem to work. Through some kind of magic, however, the setting data seems to migrate from $config over to settings system (if prefetch and config_only are *disabled*). --- CRM/Admin/Form/Setting/Mail.php | 5 ++++- CRM/Mailing/Form/Upload.php | 2 +- CRM/Mailing/Info.php | 2 +- settings/Mailing.setting.php | 14 ++++++++++++++ templates/CRM/Admin/Form/Setting/Mail.tpl | 2 +- 5 files changed, 21 insertions(+), 4 deletions(-) diff --git a/CRM/Admin/Form/Setting/Mail.php b/CRM/Admin/Form/Setting/Mail.php index 7d1a87660f..be2003c4ba 100644 --- a/CRM/Admin/Form/Setting/Mail.php +++ b/CRM/Admin/Form/Setting/Mail.php @@ -38,6 +38,10 @@ */ class CRM_Admin_Form_Setting_Mail extends CRM_Admin_Form_Setting { + protected $_settings = array( + 'replyTo' => CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, + ); + /** * Build the form object. * @@ -49,7 +53,6 @@ class CRM_Admin_Form_Setting_Mail extends CRM_Admin_Form_Setting { $this->addElement('text', 'mailerBatchLimit', ts('Mailer Batch Limit')); $this->addElement('text', 'mailThrottleTime', ts('Mailer Throttle Time')); $this->addElement('text', 'mailerJobSize', ts('Mailer Job Size')); - $this->addElement('advcheckbox', 'replyTo', ts('Enable Custom Reply-To')); $this->addElement('text', 'mailerJobsMax', ts('Mailer CRON job limit')); $check = TRUE; diff --git a/CRM/Mailing/Form/Upload.php b/CRM/Mailing/Form/Upload.php index 7a57421c4c..4b4614edb3 100644 --- a/CRM/Mailing/Form/Upload.php +++ b/CRM/Mailing/Form/Upload.php @@ -236,7 +236,7 @@ class CRM_Mailing_Form_Upload extends CRM_Core_Form { ); //Added code to add custom field as Reply-To on form when it is enabled from Mailer settings - if (isset($config->replyTo) && !empty($config->replyTo) && empty($options['override_verp'])) { + if ((int) CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, 'replyTo') && empty($options['override_verp'])) { $this->add('select', 'reply_to_address', ts('Reply-To'), array('' => '- select -') + $fromEmailAddress ); diff --git a/CRM/Mailing/Info.php b/CRM/Mailing/Info.php index b9fbc681da..8f12688693 100644 --- a/CRM/Mailing/Info.php +++ b/CRM/Mailing/Info.php @@ -134,7 +134,7 @@ class CRM_Mailing_Info extends CRM_Core_Component_Info { 'mailTokens' => $mailTokens['values'], 'contactid' => $contactID, 'requiredTokens' => CRM_Utils_Token::getRequiredTokens(), - 'enableReplyTo' => isset($config->replyTo) ? $config->replyTo : 0, + 'enableReplyTo' => (int) CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, 'replyTo'), 'fromAddress' => array_values($fromAddress['values'][0]['api.OptionValue.get']['values']), 'defaultTestEmail' => civicrm_api3('Contact', 'getvalue', array( 'id' => 'user_contact_id', diff --git a/settings/Mailing.setting.php b/settings/Mailing.setting.php index c42f5dfb89..612974c336 100644 --- a/settings/Mailing.setting.php +++ b/settings/Mailing.setting.php @@ -94,6 +94,20 @@ return array( 'description' => NULL, 'help_text' => NULL, ), + 'replyTo' => array( + 'group_name' => 'Mailing Preferences', + 'group' => 'mailing', + 'name' => 'replyTo', + 'type' => 'Boolean', + 'quick_form_type' => 'YesNo', + 'default' => 0, + 'add' => '4.6', + 'title' => 'Enable Custom Reply-To', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'Allow CiviMail users to send mailings with a custom Reply-To header', + 'help_text' => NULL, + ), 'mailing_backend' => array( 'group_name' => 'Mailing Preferences', 'group' => 'mailing', diff --git a/templates/CRM/Admin/Form/Setting/Mail.tpl b/templates/CRM/Admin/Form/Setting/Mail.tpl index f432216825..6bc8cfd95f 100644 --- a/templates/CRM/Admin/Form/Setting/Mail.tpl +++ b/templates/CRM/Admin/Form/Setting/Mail.tpl @@ -52,7 +52,7 @@ {$form.replyTo.label}{$form.replyTo.html}
- {ts}Check to enable Reply To functionality for CiviMail.{/ts} + {ts}Allow CiviMail users to send mailings with a custom Reply-To header.{/ts}
{include file="CRM/common/formButtons.tpl" location="bottom"}
-- 2.25.1