Commit 62533c68 authored by RoSk0's avatar RoSk0

Code style cleanup.

parent 22c7c006
......@@ -4,6 +4,7 @@
* CRM Contact Entity Class.
*/
class CRMCoreContactEntity extends Entity {
protected function defaultLabel() {
return crm_core_contact_label($this);
}
......@@ -16,43 +17,47 @@ class CRMCoreContactEntity extends Entity {
),
);
}
/**
* Method for de-duplicating contacts
*
* Allows various modules to identify duplicate contact records through
/**
* Method for de-duplicating contacts.
*
* Allows various modules to identify duplicate contact records through
* hook_crm_core_contact_match. This function should implement it's
* own contact matching scheme.
*
* @param CRMCoreContactEntity $entity
* CRM Core Contact
*
* @return array
* Array of matched contacts.
*/
public function match($entity){
public function match(CRMCoreContactEntity $entity) {
$checks = & drupal_static(__FUNCTION__);
$matches = array();
if(!isset($checks->processed)){
if (!isset($checks->processed)) {
$checks = new stdClass();
$checks->engines = module_implements('crm_core_contact_match');
$checks->processed = 1;
}
// pass in the contact and the matches array as references.
// this will allow various matching tools to modify the contact
// and the list of matches
// Pass in the contact and the matches array as references.
// This will allow various matching tools to modify the contact
// and the list of matches.
$values = array(
'contact' => &$entity,
'matches' => &$matches,
);
foreach ($checks->engines as $module){
foreach ($checks->engines as $module) {
module_invoke($module, 'crm_core_contact_match', $values);
}
// it's up to implementing modules to handle the matching logic.
// Most often, the match to be used should be the one
// It's up to implementing modules to handle the matching logic.
// Most often, the match to be used should be the one
// at the top of the stack.
return $matches;
}
}
/**
......@@ -63,6 +68,7 @@ class CRMCoreContactEntity extends Entity {
* special handling for contact objects.
*/
class CRMCoreContactController extends EntityAPIController {
public $revisionKey = 'vid';
public $revisionTable = 'crm_core_contact_revision';
......@@ -81,13 +87,14 @@ class CRMCoreContactController extends EntityAPIController {
return parent::create($values);
}
/**
* Update contact object before saving revision.
*/
protected function saveRevision($entity) {
$entity->log = '';
$entity->is_new_revision = TRUE;
return parent::saveRevision($entity);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment