Skip to content
Snippets Groups Projects
Commit 62533c68 authored by Kirill Roskolii's avatar Kirill Roskolii
Browse files

Code style cleanup.

parent 22c7c006
No related branches found
No related tags found
No related merge requests found
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
* CRM Contact Entity Class. * CRM Contact Entity Class.
*/ */
class CRMCoreContactEntity extends Entity { class CRMCoreContactEntity extends Entity {
protected function defaultLabel() { protected function defaultLabel() {
return crm_core_contact_label($this); return crm_core_contact_label($this);
} }
...@@ -18,13 +19,19 @@ class CRMCoreContactEntity extends Entity { ...@@ -18,13 +19,19 @@ class CRMCoreContactEntity extends Entity {
} }
/** /**
* Method for de-duplicating contacts * Method for de-duplicating contacts.
* *
* Allows various modules to identify duplicate contact records through * Allows various modules to identify duplicate contact records through
* hook_crm_core_contact_match. This function should implement it's * hook_crm_core_contact_match. This function should implement it's
* own contact matching scheme. * 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__); $checks = & drupal_static(__FUNCTION__);
$matches = array(); $matches = array();
...@@ -35,9 +42,9 @@ class CRMCoreContactEntity extends Entity { ...@@ -35,9 +42,9 @@ class CRMCoreContactEntity extends Entity {
$checks->processed = 1; $checks->processed = 1;
} }
// pass in the contact and the matches array as references. // Pass in the contact and the matches array as references.
// this will allow various matching tools to modify the contact // This will allow various matching tools to modify the contact
// and the list of matches // and the list of matches.
$values = array( $values = array(
'contact' => &$entity, 'contact' => &$entity,
'matches' => &$matches, 'matches' => &$matches,
...@@ -46,13 +53,11 @@ class CRMCoreContactEntity extends Entity { ...@@ -46,13 +53,11 @@ class CRMCoreContactEntity extends Entity {
module_invoke($module, 'crm_core_contact_match', $values); module_invoke($module, 'crm_core_contact_match', $values);
} }
// it's up to implementing modules to handle the matching logic. // It's up to implementing modules to handle the matching logic.
// Most often, the match to be used should be the one // Most often, the match to be used should be the one
// at the top of the stack. // at the top of the stack.
return $matches; return $matches;
} }
} }
/** /**
...@@ -63,6 +68,7 @@ class CRMCoreContactEntity extends Entity { ...@@ -63,6 +68,7 @@ class CRMCoreContactEntity extends Entity {
* special handling for contact objects. * special handling for contact objects.
*/ */
class CRMCoreContactController extends EntityAPIController { class CRMCoreContactController extends EntityAPIController {
public $revisionKey = 'vid'; public $revisionKey = 'vid';
public $revisionTable = 'crm_core_contact_revision'; public $revisionTable = 'crm_core_contact_revision';
...@@ -88,6 +94,7 @@ class CRMCoreContactController extends EntityAPIController { ...@@ -88,6 +94,7 @@ class CRMCoreContactController extends EntityAPIController {
protected function saveRevision($entity) { protected function saveRevision($entity) {
$entity->log = ''; $entity->log = '';
$entity->is_new_revision = TRUE; $entity->is_new_revision = TRUE;
return parent::saveRevision($entity); return parent::saveRevision($entity);
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment