function _civicrm_entity_contact_assign_rel_type_list_field_remove_contact_relationship in CiviCRM Entity 7.2
Helper function, set a relationship to inactive and set end date to "now"
Parameters
$contact_a_id:
$contact_b_id:
$relationship_type_id:
1 call to _civicrm_entity_contact_assign_rel_type_list_field_remove_contact_relationship()
- _civicrm_entity_contact_assign_rel_type_list_field_process_field_items in modules/
civicrm_entity_contact_assign_rel_type_list_field/ civicrm_entity_contact_assign_rel_type_list_field.module - Helper function to process field items on entity insert or update
File
- modules/
civicrm_entity_contact_assign_rel_type_list_field/ civicrm_entity_contact_assign_rel_type_list_field.module, line 562 - Provide CiviCRM Entity Contact Assign Relationship Type List Field Type. Provides a widget for adding/removing a contacts relationships to a configured global contact.
Code
function _civicrm_entity_contact_assign_rel_type_list_field_remove_contact_relationship($contact_a_id, $contact_b_id, $relationship_type_id) {
civicrm_initialize();
try {
$end_date = date('Y-m-d');
$relationship_result = civicrm_api3('Relationship', 'get', array(
'relationship_type_id' => $relationship_type_id,
'contact_id_a' => $contact_a_id,
'contact_id_b' => $contact_b_id,
));
if ($relationship_result['count']) {
$params = array(
'id' => $relationship_result['id'],
'contact_id_a' => $contact_a_id,
'contact_id_b' => $contact_b_id,
'relationship_type_id' => $relationship_type_id,
'is_active' => 0,
'end_date' => $end_date,
);
}
$result = civicrm_api3('Relationship', 'create', $params);
} catch (CiviCRM_API3_Exception $e) {
}
}