You are here

function redhen_relation_handler_field_primary_contact::query in RedHen CRM 7

Called to add the field to a query.

Overrides views_handler_field::query

File

modules/redhen_relation/includes/views/redhen_relation_handler_field_primary_contact.inc, line 11
Field that indicates of a specific contact is the primary contact for an organization

Class

redhen_relation_handler_field_primary_contact
@file Field that indicates of a specific contact is the primary contact for an organization

Code

function query() {
  $this
    ->ensure_my_table();
  $contact_table = $this
    ->ensure_table('redhen_contact');
  $org_table = $this
    ->ensure_table('redhen_org', $this->relationship);
  $comparison = $org_table . '.primary_contact_id = ' . $contact_table . '.contact_id';
  $this->field_alias = $this->query
    ->add_field(NULL, $comparison, 'is_primary');
  $this
    ->add_additional_fields();
}