Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
fee14197 | 4 | | CiviCRM version 5 | |
6a488035 | 5 | +--------------------------------------------------------------------+ |
6b83d5bd | 6 | | Copyright CiviCRM LLC (c) 2004-2019 | |
6a488035 TO |
7 | +--------------------------------------------------------------------+ |
8 | | This file is a part of CiviCRM. | | |
9 | | | | |
10 | | CiviCRM is free software; you can copy, modify, and distribute it | | |
11 | | under the terms of the GNU Affero General Public License | | |
12 | | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | | |
13 | | | | |
14 | | CiviCRM is distributed in the hope that it will be useful, but | | |
15 | | WITHOUT ANY WARRANTY; without even the implied warranty of | | |
16 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | | |
17 | | See the GNU Affero General Public License for more details. | | |
18 | | | | |
19 | | You should have received a copy of the GNU Affero General Public | | |
20 | | License and the CiviCRM Licensing Exception along | | |
21 | | with this program; if not, contact CiviCRM LLC | | |
22 | | at info[AT]civicrm[DOT]org. If you have questions about the | | |
23 | | GNU Affero General Public License or the licensing of CiviCRM, | | |
24 | | see the CiviCRM license FAQ at http://civicrm.org/licensing | | |
25 | +--------------------------------------------------------------------+ | |
d25dd0ee | 26 | */ |
6a488035 TO |
27 | |
28 | /** | |
29 | * | |
30 | * @package CRM | |
6b83d5bd | 31 | * @copyright CiviCRM LLC (c) 2004-2019 |
6a488035 TO |
32 | */ |
33 | ||
34 | /** | |
74f89a9f | 35 | * This class generates form components for the maling component preferences. |
6a488035 TO |
36 | */ |
37 | class CRM_Admin_Form_Preferences_Mailing extends CRM_Admin_Form_Preferences { | |
6a488035 | 38 | |
74f89a9f | 39 | protected $_settings = [ |
40 | 'profile_double_optin' => CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, | |
41 | 'profile_add_to_group_double_optin' => CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, | |
42 | 'track_civimail_replies' => CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, | |
43 | 'civimail_workflow' => CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, | |
44 | 'civimail_multiple_bulk_emails' => CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, | |
45 | 'civimail_server_wide_lock' => CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, | |
46 | 'include_message_id' => CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, | |
47 | 'write_activity_record' => CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, | |
48 | 'disable_mandatory_tokens_check' => CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, | |
49 | 'dedupe_email_default' => CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, | |
50 | 'hash_mailing_url' => CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, | |
51 | 'auto_recipient_rebuild' => CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, | |
52 | ]; | |
5c61cec2 | 53 | |
00be9182 | 54 | public function postProcess() { |
5c61cec2 KJ |
55 | $params = $this->controller->exportValues($this->_name); |
56 | ||
a7488080 | 57 | if (empty($params['write_activity_record'])) { |
74f89a9f | 58 | // @todo use the setting onToggle & add an action rather than have specific form handling. |
59 | // see logging setting for eg. | |
aaffa79f | 60 | $existingViewOptions = Civi::settings()->get('contact_view_options'); |
5c61cec2 | 61 | |
f5c8ccf8 SL |
62 | $displayViewOptions = CRM_Core_OptionGroup::values('contact_view_options', TRUE, FALSE, FALSE, NULL, 'name'); |
63 | $displayValue = $displayViewOptions['CiviMail']; | |
64 | ||
5c61cec2 KJ |
65 | $viewOptions = explode(CRM_Core_DAO::VALUE_SEPARATOR, $existingViewOptions); |
66 | ||
67 | if (!in_array($displayValue, $viewOptions)) { | |
68 | $existingViewOptions .= $displayValue . CRM_Core_DAO::VALUE_SEPARATOR; | |
69 | ||
08ef4ddd | 70 | Civi::settings()->set('contact_view_options', $existingViewOptions); |
5c61cec2 KJ |
71 | CRM_Core_Session::setStatus(ts('We have automatically enabled the Mailings tab for the Contact Summary screens |
72 | so that you can view mailings sent to each contact.'), ts('Saved'), 'success'); | |
73 | } | |
74 | } | |
75 | ||
76 | parent::postProcess(); | |
77 | } | |
96025800 | 78 | |
9d72cede | 79 | } |