Details
-
Type: New Feature
-
Status: Done/Fixed
-
Priority: Major
-
Resolution: Fixed/Completed
-
Affects Version/s: None
-
Fix Version/s: 1.3
-
Component/s: None
-
Labels:None
Description
Given that Profiles (uf_group instances) are going to be used for specific contexts (User Registration, Contribution pages, etc.) - it no longer makes sense to store the contact dupe matching rules in uf_field rows.
For this first phase, we will implement replacement functionality for the existing configurable rules for contact INDIVIDUALS. However, the class structure will support configuration of rules for ORGANIZATIONS and potentially other types of objects at a later date.
1. Create new class/table under Core:
DupeRule (civicrm_dupe_rule)
id (PK)
domain_id
entity_table
rule (varchar 255)
2. Modify fixed data to insert a default record in this table:
domain_id=1
entity_table = 'civicrm_individual'
rule = 'first_name AND last_name AND email'
3. Modify contact duplicate matching code to retrieve and parse 'rules' from the string stored civicrm_dupe_match.rule (for the active domain)
3.1 The 'rule' string can contain the following elements:
- any valid civicrm core or custom field name
- parentheses
- AND
- OR
3.2 Dupe matching code converts the pseudo sql in 'rule' into the required sql match query
3.3 The UI will support either 'basic' configuration using AND conjunction only (matches current functionality) OR 'advanced' configuration which will be done through manual user editing of the string.
4. UI for modifying duplicate matching rules
4.1 Create new admin menu item in the 'Configure' group: "Duplicate Matching"
4.2 This links to a single page with two forms/fieldsets ('basic' and 'advanced')
4.2.1 'Configure Duplicate Contact Matching' (fieldset for basic configuration) :
- this form/fieldset is displayed IF the rule string contains only valid fieldnames and the AND conjunction (no OR conjunctions, no parenthetical expressions) - else it is hidden
- includes 5 drop-down (<select>) elements labeled "Match On:"
- select values = core and custom contact individual fields (same as 'import' set when importing contacts with type = individual, omitting 'related contact info' values)
- values are set by parsing 'rule' string AFTER determining that the string contains ONLY field names and the 'AND' conjunction
- post-process re-creates the rule string based on the selected Match On values
- a link to display the '>> Advanced Configuration' is included when the basic form is visible (clicking this link hides the 'basic' form)
4.2.1 'Advanced Duplicate Contact Matching'
- this form/fieldset allows direct editing of the rule string
- it is hidden by default, but displayed when rule contains OR, any parentheses (also, when 'Advanced Configuration' link has been clicked)
- fieldset contains a <textarea> element with the current rule string value, and allows user to edit that value
- post-process validation checks for AND, OR, parens and valid fieldnames (anything else throws a validation error), then saves the rule string