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

Fix custom field form notices w/ relationships between contact sub-types and default types

    Details

    • Versioning Impact:
      Patch (backwards-compatible bug fixes)
    • Documentation Required?:
      User and Admin Doc
    • Funding Source:
      Contributed Code

      Description

      When using a sub-type as the left-hand (A) side of a relationship with a default type on the right (B), the following notices appear on the custom fields form (/civicrm/admin/custom/group?action=add&reset=1):

      Notice: Undefined index: 20_a_b in CRM_Custom_Form_Group::getFormattedList() (line 536 of /.../civicrm/CRM/Custom/Form/Group.php).
      Notice: Undefined index: 20_a_b in CRM_Custom_Form_Group::getFormattedList() (line 538 of /.../civicrm/CRM/Custom/Form/Group.php).
      Notice: Undefined index: 20_a_b in CRM_Custom_Form_Group::getFormattedList() (line 539 of /.../civicrm/CRM/Custom/Form/Group.php).

      To reproduce:

      1. Create a contact subtype (e.g. 'student' as a sub-type of individual)
      2. Define a relationship between the new contact sub-type and a default contact type (e.g. organization)
      3. Add a 'New Custom Field Set' (/civicrm/admin/custom/group?action=add&reset=1) and the warning will be displayed.
      4. Select 'Relationships' in the 'Used for' field
      5. Scroll through the select box, and the relevant option will be missing part of the label.

      Note the following:

      • reversing the relationship resolves the issue (so there's an easy work-around)
      • having both contacts in the relationship be sub-types (another easy work-around).

      I haven't gone any further in testing whether this is really just a form-building/display bug, or whether defining a field based on this relationship would fail in other ways.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              ergonlogic Christopher Gervais
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: