Feature Request: Add action to bulk de-activate or re-activate a relationship
Overview
When performing a search and selecting a number of contacts on return, there is an action to "Add relationship to - ..." That works great, but annually we need to set a number of relationships inactive (is_active=0) to not only disable the relation but so the history shows up in the contacts Relationships view as Inactive relationships. Additionally, we annually need to re-activate some of these relationships (is_active=1). Our staff would prefer to simply disable/enable via the Actions pull-down after selecting a group of contacts to either de-activate or re-activate a relationship. The request is to add a few actions in the pull-down post-search to (i) disable a relationship; (ii) re-enable a relationship.
Example use-case
The context for our organization, a bike coalition, is that we have a number of bike clubs as organizational contacts. Within each bike club, we have their members as individual contacts and we tie members to their club(s) via a relation. Since bike club members come and go annually, we go through a process of adding, disabling, or re-enabling individuals to the various bike clubs to which they belong. This annual process must be done for up to thousands of contacts and it is either completely tedious for non-technical staff or requires SQL expertise at the risk of damaging our database. This use case would apply to any CiviCRM organization that has a number of sub-organizations, each of which has multiple individual members which change at some frequency.
Current behavior
Our non-technical staff can only Add a new relationship from the Actions pull-down to do any bulk relationship operations. To do what we want, they can click on a single individual, click on the relationship and disable any active relationship. Alternatively, they can Enable an inactive relationship from the list under Relationships. This can be done one at a time by non-technical staff - hours of tedious, error-prone mouse clicks.
Staff who have access to the database and are familiar with SQL can set is_active=0 (or 1) as in this example:
UPDATE civicrm_relationship SET is_active=0 WHERE contact_id_b=384 AND relationship_type_id=17 AND (contact_id_a=386 OR contact_id_a=389 OR contact_id_a=390);
In that case, contact_id_a are 3 individuals, contact_id_b=384 is a bike club and relationship_type_id=17 indicates "Club Member of"
There may be unintended consequences with such a query, although it has been our go-to action for the past couple years.
Proposed behavior
- Perform any search and select contacts from the result.
- Under Actions, we would like these additional actions
- Disable relationship to - Individual
- Disable relationship to - Household
- Disable relationship to - Organization
- Enable relationship to - Individual
- Enable relationship to - Household
- Enable relationship to - Organization
Alternatively, to avoid the pull-down being too long, you could just have one item "Relationship operation" and that could pop up a dialogue to select Individual, Household, Organization, as well as Add, Disable, Enable, and I suppose Delete might be a 4th thing to add.
Comments
It would be nice if there were an API function to do this as well. A less attractive, but still possibly useful way to perform what we need to do on thousands of contacts annually would be to provide an API function with args (contact_id_a, contact_id_b, relationship_type_id) and the ability to add|disable|enable|delete through the API csv import function which is now available directly under Civi > Administer. The API function with entities included in API csv import would seem to be useful as a first step, anyway, to the Actions pull-down interface.