Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CATL-1614: Do not create contacts when filing email #44

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

i-grou
Copy link

@i-grou i-grou commented Aug 19, 2020

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:

  • When 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).
  • If checked: when CiviCRM checks for a matching contact, if no matching contact is found it will not create one and the email is filed.

Also:

  • Label of new field is printed to the right of the checkbox, not to the left, because left side is thin and long labels would look weird there.
  • Activity Status field label is also moved to the right for consistency. Thanks to this approach these fields would look more like Used For? dependent fields, and this would make them look more intuitive hence will improve UX.

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:
image

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:
image

Technical Details

To make it work we:

  1. Added new field to the civicrm_mail_settings db table - is_contact_creation_disabled_if_no_match. Respective upgrader is added.
  2. Updated DAO/MailSettings.php and schema MailSettings.xml files to have new field.
  3. Updated form related files - Form/MailSettings.php and MailSettings.tpl - to print new field and save the value on form submit.
  4. Updated EmailProcessor.php to handle new field during inbound email processing. This also involved updating the Incoming.php to make contact creation optional.
  5. Unit tests were added to test processing with is_contact_creation_disabled_if_no_match enabled.

@i-grou i-grou force-pushed the CATL-1614-donot-create-contacts-mail-filing branch from f8043bd to 7f523b3 Compare August 19, 2020 15:38
@i-grou i-grou force-pushed the CATL-1614-donot-create-contacts-mail-filing branch from d252e25 to a54a633 Compare August 20, 2020 12:57
@i-grou i-grou force-pushed the CATL-1614-donot-create-contacts-mail-filing branch from a54a633 to 7ae1fc2 Compare August 25, 2020 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant