CRM-15943 - Move replyTo option from $config to a setting.
authorTim Otten <totten@civicrm.org>
Wed, 25 Feb 2015 20:49:58 +0000 (12:49 -0800)
committerTim Otten <totten@civicrm.org>
Wed, 25 Feb 2015 20:49:58 +0000 (12:49 -0800)
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
CRM/Mailing/Form/Upload.php
CRM/Mailing/Info.php
settings/Mailing.setting.php
templates/CRM/Admin/Form/Setting/Mail.tpl

index 7d1a87660f7dd7e8367437075f1c6f16430edef9..be2003c4ba072f6a5590f5464775424ecedb6d38 100644 (file)
  */
 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;
 
index 7a57421c4cc0300c54a15144cbb23357be7ccdfa..4b4614edb3002722277fbf91b93cedb6fe82f09e 100644 (file)
@@ -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
       );
index b9fbc681da34e86518b0b42e8d493d1a9b12dd5c..8f12688693568591d22caa82c3459cd70707a0db 100644 (file)
@@ -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',
index c42f5dfb8956f98b8191024b37d01783da6a7813..612974c336883342372074dc3eec2dd50b2cc749 100644 (file)
@@ -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',
index f4322168255bd70467a55fadaec74092112e680f..6bc8cfd95f60b6238b0774a8114df6c94b72e9ab 100644 (file)
@@ -52,7 +52,7 @@
         </tr>
         <tr class="crm-mail-form-block-replyTo">
             <td class="label">{$form.replyTo.label}</td><td>{$form.replyTo.html}<br />
-            <span class="description">{ts}Check to enable Reply To functionality for CiviMail.{/ts}</span></td>
+            <span class="description">{ts}Allow CiviMail users to send mailings with a custom Reply-To header.{/ts}</span></td>
         </tr>
       </table>
 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>