Skip to content
Snippets Groups Projects
Commit 9babb598 authored by Olaf Buddenhagen's avatar Olaf Buddenhagen
Browse files

Add config setting to disable mandatory tokens check in mailings

As per a previous discussion (with Lobo IIRC), add a configuration
setting to disable the check for presence of mandatory tokens when
sending mailings.

This setting is implemented as a negative option, i.e. ticking the
option disables the check. We could also reverse the logic, so that
ticking the option enables the check instead; and set it to on by
default... Not sure which is preferable -- I guess that's mostly a
matter of taste.
parent 1e91fac8
No related branches found
No related tags found
No related merge requests found
......@@ -99,6 +99,13 @@ class CRM_Admin_Form_Preferences_Mailing extends CRM_Admin_Form_Preferences {
'weight' => 8,
'description' => NULL,
),
'disable_mandatory_tokens_check' =>
array(
'html_type' => 'checkbox',
'title' => ts('Disable check for mandatory tokens'),
'weight' => 9,
'description' => ts('Don\'t check for presence of mandatory tokens (domain address; unsubscribe/opt-out) before sending mailings. WARNING: Mandatory tokens are a safe-guard which facilitate compliance with the US CAN-SPAM Act. They should only be disabled if your organization adopts other mechanisms for compliance or if your organization is not subject to CAN-SPAM.'),
),
),
);
......
......@@ -613,12 +613,14 @@ class CRM_Mailing_Form_Upload extends CRM_Core_Form {
/* First look for missing tokens */
$err = CRM_Utils_Token::requiredTokens($str);
if ($err !== TRUE) {
foreach ($err as $token => $desc) {
$dataErrors[] = '<li>' . ts('This message is missing a required token - {%1}: %2',
array(1 => $token, 2 => $desc)
) . '</li>';
if (!CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, 'disable_mandatory_tokens_check')) {
$err = CRM_Utils_Token::requiredTokens($str);
if ($err !== TRUE) {
foreach ($err as $token => $desc) {
$dataErrors[] = '<li>' . ts('This message is missing a required token - {%1}: %2',
array(1 => $token, 2 => $desc)
) . '</li>';
}
}
}
......
......@@ -136,4 +136,18 @@ return array(
'description' => 'When CiviMail is enabled, users who "subscribe" to a group from a profile Group(s) checkbox will receive a confirmation email. They must respond (opt-in) before they are added to the group.',
'help_text' => null,
),
'disable_mandatory_tokens_check' => array(
'group_name' => 'Mailing Preferences',
'group' => 'mailing',
'name' => 'disable_mandatory_tokens_check',
'type' => 'Integer',
'html_type' => 'checkbox',
'default' => 0,
'add' => '4.4',
'title' => 'Disable check for mandatory tokens',
'is_domain' => 1,
'is_contact' => 0,
'description' => 'Don\'t check for presence of mandatory tokens (domain address; unsubscribe/opt-out) before sending mailings. WARNING: Mandatory tokens are a safe-guard which facilitate compliance with the US CAN-SPAM Act. They should only be disabled if your organization adopts other mechanisms for compliance or if your organization is not subject to CAN-SPAM.',
'help_text' => null,
),
);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment