forked from civicrm/civicrm-core
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CATL-1614: Add new field to the mail account form - Do not create new…
… contacts when filing emails
- Loading branch information
Showing
7 changed files
with
118 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,62 +9,71 @@ | |
*} | ||
{* this template is used for adding/editing email settings. *} | ||
<div class="crm-block crm-form-block crm-mail-settings-form-block"> | ||
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div> | ||
{if $action eq 8} | ||
<div class="messages status no-popup"> | ||
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div> | ||
{if $action eq 8} | ||
<div class="messages status no-popup"> | ||
{icon icon="fa-info-circle"}{/icon} | ||
{ts}WARNING: Deleting this option will result in the loss of mail settings data.{/ts} {ts}Do you want to continue?{/ts} | ||
</div> | ||
{ts}WARNING: Deleting this option will result in the loss of mail settings data.{/ts} {ts}Do you want to continue?{/ts} | ||
</div> | ||
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div> | ||
{else} | ||
{else} | ||
<table class="form-layout-compressed"> | ||
|
||
<tr class="crm-mail-settings-form-block-name"><td class="label">{$form.name.label}</td><td>{$form.name.html}</td></tr> | ||
<tr><td class="label"> </td><td class="description">{ts}Name of this group of settings.{/ts}</td></tr> | ||
<tr class="crm-mail-settings-form-block-name"><td class="label">{$form.name.label}</td><td>{$form.name.html}</td></tr> | ||
<tr><td class="label"> </td><td class="description">{ts}Name of this group of settings.{/ts}</td></tr> | ||
|
||
<tr class="crm-mail-settings-form-block-server"><td class="label">{$form.server.label}</td><td>{$form.server.html}</td></tr> | ||
<tr><td class="label"> </td><td class="description">{ts}Name or IP address of mail server machine.{/ts}</td></tr> | ||
<tr class="crm-mail-settings-form-block-server"><td class="label">{$form.server.label}</td><td>{$form.server.html}</td></tr> | ||
<tr><td class="label"> </td><td class="description">{ts}Name or IP address of mail server machine.{/ts}</td></tr> | ||
|
||
<tr class="crm-mail-settings-form-block-username"><td class="label">{$form.username.label}</td><td>{$form.username.html}</td></tr> | ||
<tr><td class="label"> </td><td class="description">{ts}Username to use when polling (for IMAP and POP3).{/ts}</td></tr> | ||
<tr class="crm-mail-settings-form-block-username"><td class="label">{$form.username.label}</td><td>{$form.username.html}</td></tr> | ||
<tr><td class="label"> </td><td class="description">{ts}Username to use when polling (for IMAP and POP3).{/ts}</td></tr> | ||
|
||
<tr class="crm-mail-settings-form-block-password"><td class="label">{$form.password.label}</td><td>{$form.password.html}</td></tr> | ||
<tr><td class="label"> </td><td class="description">{ts}Password to use when polling (for IMAP and POP3).{/ts}</td></tr> | ||
<tr class="crm-mail-settings-form-block-password"><td class="label">{$form.password.label}</td><td>{$form.password.html}</td></tr> | ||
<tr><td class="label"> </td><td class="description">{ts}Password to use when polling (for IMAP and POP3).{/ts}</td></tr> | ||
|
||
<tr class="crm-mail-settings-form-block-localpart"><td class="label">{$form.localpart.label}</td><td>{$form.localpart.html}</td></tr> | ||
<tr><td class="label"> </td><td class="description">{ts}Optional local part (e.g., 'civimail+' for addresses like [email protected]).{/ts}</td></tr> | ||
<tr class="crm-mail-settings-form-block-localpart"><td class="label">{$form.localpart.label}</td><td>{$form.localpart.html}</td></tr> | ||
<tr><td class="label"> </td><td class="description">{ts}Optional local part (e.g., 'civimail+' for addresses like [email protected]).{/ts}</td></tr> | ||
|
||
<tr class="crm-mail-settings-form-block-domain"><td class="label">{$form.domain.label}</td><td>{$form.domain.html}</td></tr> | ||
<tr><td class="label"> </td><td class="description">{ts}Email address domain (the part after @).{/ts}</td></tr> | ||
<tr class="crm-mail-settings-form-block-domain"><td class="label">{$form.domain.label}</td><td>{$form.domain.html}</td></tr> | ||
<tr><td class="label"> </td><td class="description">{ts}Email address domain (the part after @).{/ts}</td></tr> | ||
|
||
<tr class="crm-mail-settings-form-block-return_path"><td class="label">{$form.return_path.label}</td><td>{$form.return_path.html}</td><tr> | ||
<tr><td class="label"> </td><td class="description">{ts}Contents of the Return-Path header.{/ts}</td></tr> | ||
<tr class="crm-mail-settings-form-block-return_path"><td class="label">{$form.return_path.label}</td><td>{$form.return_path.html}</td><tr> | ||
<tr><td class="label"> </td><td class="description">{ts}Contents of the Return-Path header.{/ts}</td></tr> | ||
|
||
<tr class="crm-mail-settings-form-block-protocol"><td class="label">{$form.protocol.label}</td><td>{$form.protocol.html}</td></tr> | ||
<tr><td class="label"> </td><td class="description">{ts}Name of the protocol to use for polling.{/ts}</td></tr> | ||
<tr class="crm-mail-settings-form-block-protocol"><td class="label">{$form.protocol.label}</td><td>{$form.protocol.html}</td></tr> | ||
<tr><td class="label"> </td><td class="description">{ts}Name of the protocol to use for polling.{/ts}</td></tr> | ||
|
||
<tr class="crm-mail-settings-form-block-source"><td class="label">{$form.source.label}</td><td>{$form.source.html}</td></tr> | ||
<tr><td class="label"> </td><td class="description">{ts}Folder to poll from when using IMAP (will default to INBOX when empty), path to poll from when using Maildir, etc..{/ts}</td></tr> | ||
<tr class="crm-mail-settings-form-block-source"><td class="label">{$form.source.label}</td><td>{$form.source.html}</td></tr> | ||
<tr><td class="label"> </td><td class="description">{ts}Folder to poll from when using IMAP (will default to INBOX when empty), path to poll from when using Maildir, etc..{/ts}</td></tr> | ||
|
||
<tr class="crm-mail-settings-form-block-is_ssl"><td class="label">{$form.is_ssl.label}</td><td>{$form.is_ssl.html}</td></tr> | ||
<tr><td class="label"> </td><td class="description">{ts}Whether to use SSL for IMAP and POP3 or not.{/ts}</td></tr> | ||
<tr class="crm-mail-settings-form-block-is_ssl"><td class="label">{$form.is_ssl.label}</td><td>{$form.is_ssl.html}</td></tr> | ||
<tr><td class="label"> </td><td class="description">{ts}Whether to use SSL for IMAP and POP3 or not.{/ts}</td></tr> | ||
|
||
<tr class="crm-mail-settings-form-block-is_default"><td class="label">{$form.is_default.label}</td><td>{$form.is_default.html}</td></tr> | ||
<tr><td class="label"> </td><td class="description">{ts}How this mail account will be used. Only one box may be used for bounce processing. It will also be used as the envelope email when sending mass mailings.{/ts}</td></tr> | ||
<tr class="crm-mail-settings-form-block-is_default"><td class="label">{$form.is_default.label}</td><td>{$form.is_default.html}</td></tr> | ||
<tr><td class="label"> </td><td class="description">{ts}How this mail account will be used. Only one box may be used for bounce processing. It will also be used as the envelope email when sending mass mailings.{/ts}</td></tr> | ||
|
||
<tr class="crm-mail-settings-form-block-activity_status"><td class="label">{$form.activity_status.label}</td><td>{$form.activity_status.html}</td></tr> | ||
<tr class="crm-mail-settings-form-block-is_contact_creation_disabled_if_no_match"><td class="label"> </td><td>{$form.is_contact_creation_disabled_if_no_match.html}{$form.is_contact_creation_disabled_if_no_match.label}</td></tr> | ||
|
||
<tr class="crm-mail-settings-form-block-activity_status"><td class="label"> </td><td>{$form.activity_status.label}<div>{$form.activity_status.html}</div></td></tr> | ||
</table> | ||
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div> | ||
{/if} | ||
|
||
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div> | ||
{/if} | ||
</div> | ||
|
||
{literal} | ||
<script type="text/javascript"> | ||
CRM.$(function($) { | ||
var $form = $('form.{/literal}{$form.formClass}{literal}'); | ||
function showActivityStatus() { | ||
$('.crm-mail-settings-form-block-activity_status', $form).toggle($(this).val() === '0'); | ||
function showActivityFields() { | ||
var fields = [ | ||
'.crm-mail-settings-form-block-activity_status', | ||
'.crm-mail-settings-form-block-is_contact_creation_disabled_if_no_match', | ||
]; | ||
$(fields.join(', '), $form).toggle($(this).val() === '0'); | ||
} | ||
$('select[name=is_default]').each(showActivityStatus).change(showActivityStatus); | ||
$('select[name="is_default"]').each(showActivityFields).change(showActivityFields); | ||
}); | ||
</script> | ||
{/literal} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -169,4 +169,37 @@ public function setUpMailing() { | |
$this->eventQueue = $this->callAPISuccess('MailingEventQueue', 'get', ['api.MailingEventQueue.create' => ['hash' => 'aaaaaaaaaaaaaaaa']]); | ||
} | ||
|
||
/** | ||
* Set up mail account with 'Do not create new contacts when filing emails' | ||
* option enabled. | ||
*/ | ||
public function setUpDoNotCreateContact() { | ||
$this->callAPISuccess('MailSettings', 'get', [ | ||
'api.MailSettings.create' => [ | ||
'name' => 'mailbox', | ||
'protocol' => 'Localdir', | ||
'source' => __DIR__ . '/data/mail', | ||
'domain' => 'example.com', | ||
'is_default' => '0', | ||
'is_contact_creation_disabled_if_no_match' => TRUE, | ||
], | ||
]); | ||
} | ||
|
||
/** | ||
* Test case email processing when is_non_case_email_skipped is enabled. | ||
*/ | ||
public function testInboundProcessingDoNotCreateContact() { | ||
$this->setUpDoNotCreateContact(); | ||
$mail = 'test_non_cases_email.eml'; | ||
|
||
copy(__DIR__ . '/data/inbound/' . $mail, __DIR__ . '/data/mail/' . $mail); | ||
$this->callAPISuccess('job', 'fetch_activities', []); | ||
$result = civicrm_api3('Contact', 'get', [ | ||
'sequential' => 1, | ||
'email' => "[email protected]", | ||
]); | ||
$this->assertEmpty($result['values']); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters