Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-10

Contact Relationships Functionality (/crm/contact/view/rels)


    • Type: New Feature
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Fixed/Completed
    • Affects Version/s: None
    • Fix Version/s: 1.0
    • Component/s: None
    • Labels:


      1. Contact Relationship summary:
      1.1 User clicks Relationships tab from View Contact
      1.2. If no existing relationships, display status message
      <div class="message status">There are no Relationships entered for this contact.</div>
      and form button: [ New Relationship ]
      1.3 If existing relationships, display in selector-style table as shown in crm_view_contact_relations.png
      Include form button: [ New Relationship ] above and below selector as shown

      2. New Relationship
      2.1 Accessed via New Relationship button from summary, OR from "Create Relationship" link on main View Contact (Contact Info) page.
      2.2 New Relationship process is a 2-step 'wizard' using it's own template (separate page from Relationship summary, and NOT a pop-up as shown in the wireframe)
      2.3 Initial form display as shown in top half of crm_view_contact_relations.png

      • title
      • $display_name is <select from relationship_type_names/> of:
      • explanation box (e.g. "Use 'Search' to ...)
      • mini search form (contact_type select and sort_name field)
        2.4 Search Results are displayed in simple selector table as shown in lower half of crm_view_contact_relations.png
        2.5 Create Relationship form now displayed also includes Starting and Ending date selects and form buttons: [ Create Relationship(s) ] [ Cancel ]
        2.6 On success, return to Relationship Summary for this contact with status message

      3. Populating relationship_type <select> options (the drop-down where user selects the type - e.g. 'Parent', 'Spouse', etc.)
      3.1 We want this drop-down to offer options that are meaningful based on the type of contact they are creating the relationship for (i.e. the current contactId). For example - it doesn't make sense to include 'Parent' as an option when the current contact is an Organization. "The Sierra Club is a 'Parent' of..." doesn't make sense - and would violate the rules for that relationship type if selected, since that type specifies that both contact_a and contact_b must be of contact_type=Individual.

      3.2 Array of options should be constructed as follows:

      • loop through crm_relationship_type rows where is_active = TRUE
      • for each row, if $contact_type_a = currentContactType AND name_a_b is not already in the array, then add $name_a_b to the array
      • for each row, if $contact_type_b = currentContactType AND name_b_a is not already in the array, then add $name_b_a to the array
      • the option values will need to include both the crm.relationship_type.id AND an indicator as to the directionality (a_b vs. b_a) of the selected label (could be something like <option value="1|b_a">Parent</option>

      4. Use selected relationship_type option to determine how crm_relationship record is written:
      Since each option has directionality, we can use this to determine which 'side' of the relationship gets written to crm_relationship.contact_id_a and which to crm_relationship.contact_id_b.

      EX: If the current contact is Donald Lobo (cid=22), and the selected option is 1|b_a ('Parent') and the checkmarked relationship 'target contact' is Maya Lobo (cid=35), then the Insert is:

      INSERT into crm_relationship
      (contact_id_a`, `contact_id_b`, `relationship_type_id`, `is_active`)
      (35, 22, 1, 1)




            • Assignee:
              kurund Kurund Jalmi
              dgg David Greenberg
            • Votes:
              0 Vote for this issue
              0 Start watching this issue


              • Created: