function _civicrm_entity_contact_assign_rel_contact_field_contact_has_relationship in CiviCRM Entity 7.2
Helper function to check if contact is in a group
Parameters
$contact_a_id:
$contact_b_id:
$relationship_type_id:
Return value
bool
1 call to _civicrm_entity_contact_assign_rel_contact_field_contact_has_relationship()
- _civicrm_entity_contact_assign_rel_contact_field_process_field_items in modules/
civicrm_entity_contact_assign_rel_contact_field/ civicrm_entity_contact_assign_rel_contact_field.module - Helper function to process field items on entity insert or update
File
- modules/
civicrm_entity_contact_assign_rel_contact_field/ civicrm_entity_contact_assign_rel_contact_field.module, line 635 - Provide CiviCRM Entity Contact Assign Relationship Contacts List Field Type. Provides a widget for adding/removing a contacts relationships to a list of contacts.
Code
function _civicrm_entity_contact_assign_rel_contact_field_contact_has_relationship($contact_a_id, $contact_b_id, $relationship_type_id) {
civicrm_initialize();
try {
$result = civicrm_api3('Relationship', 'get', array(
'contact_id_a' => $contact_a_id,
'contact_id_b' => $contact_b_id,
'relationship_type_id' => $relationship_type_id,
'is_active' => 1,
));
} catch (CiviCRM_API3_Exception $e) {
return FALSE;
}
if ($result['count']) {
return TRUE;
}
else {
return FALSE;
}
}