CATL-1614: Do not create contacts when filing email #44
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
According to new requirements the administrator should be able to configure whether CiviCRM will create a new contact where a contact does not already exist within the system when filing inbound emails, so that he can ensure that new contacts are not created in the system when filing an email. The email should still be filed, even if no contacts are matched.
To achieve this we added an option to the Mail Account settings (see Mail Accounts page
/civicrm/admin/mailSettings?action=add&reset=1
) to change the email to activity processing behavior:Email-to-Activity Processing
value is selected for Used For? field we need to show an additional checkbox field - Do not create new contacts when filing emails (defaults to unticked).Also:
Before
Without the new option above enabled CiviCRM will process emails as normal i.e. will always create new contacts if no matching contact found.
And Activity Status field label location is not changed:
After
With the new option above enabled CiviCRM will not create new contacts if no matching contact found, but email still will be filed.
Now form looks like this:
Technical Details
To make it work we:
civicrm_mail_settings
db table -is_contact_creation_disabled_if_no_match
. Respective upgrader is added.DAO/MailSettings.php
and schemaMailSettings.xml
files to have new field.Form/MailSettings.php
andMailSettings.tpl
- to print new field and save the value on form submit.EmailProcessor.php
to handle new field during inbound email processing. This also involved updating theIncoming.php
to make contact creation optional.is_contact_creation_disabled_if_no_match
enabled.