function crm_core_default_matching_engine_load_field_config in CRM Core 7
Loads field matching rule(config) from DB.
Parameters
string $contact_type: Machine readable contact type name.
string $field_name: Machine readable field name.
string $field_item: Field item. Currently used only in name fields.
Return value
array Field matching rule(config) or all rules for specified contact type(field name and item must be empty).
4 calls to crm_core_default_matching_engine_load_field_config()
- crm_core_match_info_page in modules/
crm_core_match/ crm_core_match.test.inc - DefaultMatchingEngine::execute in modules/
crm_core_default_matching_engine/ includes/ DefaultMatchingEngine.inc - Applies logical rules for identifying matches in the database.
- DefaultMatchingEngineFieldType::fieldRender in modules/
crm_core_default_matching_engine/ includes/ DefaultMatchingEngine.inc - Template used to render fields matching rules configuration form.
- EmailMatchField::fieldRender in modules/
crm_core_default_matching_engine/ includes/ EmailMatchField.inc - Template used to render fields matching rules configuration form.
File
- modules/
crm_core_default_matching_engine/ crm_core_default_matching_engine.module, line 113 - The default matching engine for CRM Core. Identifies duplicate contacts in the system using criteria defined by users through the configuration tools.
Code
function crm_core_default_matching_engine_load_field_config($contact_type, $field_name = '', $field_item = '') {
if (empty($field_name) && empty($field_item)) {
$rules = db_select('crm_core_match_contact_type_rules')
->fields('crm_core_match_contact_type_rules')
->condition('contact_type', $contact_type)
->condition('status', 1)
->orderBy('weight')
->execute()
->fetchAllAssoc('mrid');
return $rules;
}
else {
$config = db_select('crm_core_match_contact_type_rules')
->fields('crm_core_match_contact_type_rules')
->condition('contact_type', $contact_type)
->condition('field_name', $field_name)
->condition('field_item', $field_item)
->execute()
->fetchAssoc();
// If no settings stored in DB use defaults.
if (!$config) {
$config = array(
'operator' => '',
'status' => 0,
'score' => 0,
'options' => '',
'weight' => 10,
);
}
return $config;
}
}