function crm_core_relationship_ui_query_views_crm_relationships_by_contact_alter in CRM Core 8.3
Same name and namespace in other branches
- 8 modules/crm_core_relationship_ui/crm_core_relationship_ui.module \crm_core_relationship_ui_query_views_crm_relationships_by_contact_alter()
- 8.2 modules/crm_core_relationship_ui/crm_core_relationship_ui.module \crm_core_relationship_ui_query_views_crm_relationships_by_contact_alter()
- 7 modules/crm_core_relationship_ui/crm_core_relationship_ui.module \crm_core_relationship_ui_query_views_crm_relationships_by_contact_alter()
Alter query of view "crm_relationships_by_contact".
File
- modules/
crm_core_relationship_ui/ crm_core_relationship_ui.module, line 341 - Relationship UI module hooks.
Code
function crm_core_relationship_ui_query_views_crm_relationships_by_contact_alter($query) {
$where =& $query
->conditions();
if (!isset($where[0]['field'])) {
return;
}
$field_conditions =& $where[0]['field']
->conditions();
$field_field_conditions =& $field_conditions[0]['field']
->conditions();
// If condition is to find active relationships we also include NULL values.
if ($field_field_conditions[0]['operator'] == 'not in') {
unset($field_field_conditions[0]);
$or = db_or();
$or
->condition('field_data_field_relationship_active.field_relationship_active_value', NULL, 'IS');
$or
->condition('field_data_field_relationship_active.field_relationship_active_value', 'active', '<>');
$query
->condition($or);
}
}