You are here

function redhen_dedupe_property_mergeable in RedHen CRM 7

Determine if a given property can be merged.

Parameters

array $property: A property as returned by entity_get_all_property_info();

Return value

bool True is mergeable.

1 call to redhen_dedupe_property_mergeable()
redhen_dedupe_merge_form in modules/redhen_dedupe/includes/redhen_dedupe.form.inc
Form to select the master contact.

File

modules/redhen_dedupe/includes/redhen_dedupe.form.inc, line 295
Forms for creating, editing, and deleting contacts.

Code

function redhen_dedupe_property_mergeable($name, $property) {

  // Don't merge computed fields:
  if (isset($property['computed']) && $property['computed']) {
    return FALSE;
  }

  // Don't merge fields that can't be edited:
  if (!isset($property['setter callback'])) {
    return FALSE;
  }

  // Don't merge any base table fields except the name fields:
  $info = entity_get_info('redhen_contact');
  if (in_array($name, $info['schema_fields_sql']['base table'])) {
    if (!strstr($name, '_name')) {
      return FALSE;
    }
  }
  return TRUE;
}