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

Trying to edit contact with multiple subtypes gives error: Invalid Filter

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Critical
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.6.16, 4.7.7
    • Fix Version/s: 4.6.17, 4.7.8
    • Component/s: None
    • Labels:
      None
    • Documentation Required?:
      None
    • Funding Source:
      Contributed Code

      Description

      Summary

      Trying to access the main contact edit form for a contact that has multiple contact subtypes gives fatal error: Invalid Filter.

      Replicated on 4.6 & 4.7 demo:

      http://d46.demo.civicrm.org/civicrm/contact/view?reset=1&cid=132
      http://dmaster.demo.civicrm.org/civicrm/contact/view?reset=1&cid=155

      Steps to replicate

      1. Assign two contact subtypes to a contact: e.g. Student, Volunteer.
      2. On contact summary, click Edit to open main contact edit form.

      Expected behaviour:
      Main contact edit form opens.

      Actual behaviour:
      Fatal error:
      Sorry but we are not able to provide this at the moment.
      Invalid Filter

      Diagnosis

      Appears related to other subtype issues in 4.6.16/4.7.7 . Debugging shows that CRM/Core/BAO/CustomGroup::validateSubTypeByEntity() is passed $subType 'Student,Volunteer', comma-separated. validateSubTypeByEntity() isn't set up to deal with a comma-separated list; instead it looks for 'Student,Volunteer' in the array $subTypes that it gets from a Contact getoptions API call. Of course it doesn't find 'Student,Volunteer' so it throws exception 'Invalid Filter'.

      Backtrace:
      #0 .../civicrm/CRM/Core/BAO/CustomGroup.php(653): CRM_Core_Error::backtrace()
      #1 .../civicrm/CRM/Core/BAO/CustomGroup.php(438): CRM_Core_BAO_CustomGroup::validateSubTypeByEntity("Individual", "Student,Volunteer")
      #2 .../civicrm/CRM/Custom/Form/CustomData.php(136): CRM_Core_BAO_CustomGroup::getTree("Individual", Object(CRM_Contact_Form_Contact), "132", NULL, "Student,Volunteer", NULL, TRUE, NULL)
      #3 .../civicrm/CRM/Contact/Form/Contact.php(386): CRM_Custom_Form_CustomData::preProcess(Object(CRM_Contact_Form_Contact), NULL, "StudentVolunteer", 1, "Individual", "132")
      #4 .../civicrm/CRM/Core/Form.php(455): CRM_Contact_Form_Contact->preProcess()
      #5 .../civicrm/CRM/Core/QuickForm/Action/Display.php(94): CRM_Core_Form->buildForm()
      #6 .../civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Display->perform(Object(CRM_Contact_Form_Contact), "display")
      #7 .../civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Contact_Form_Contact), "display")
      #8 .../civicrm/CRM/Core/Controller.php(353): HTML_QuickForm_Page->handle("display")
      #9 .../civicrm/CRM/Utils/Wrapper.php(115): CRM_Core_Controller->run()
      #10 .../civicrm/CRM/Core/Invoke.php(286): CRM_Utils_Wrapper->run("CRM_Contact_Form_Contact", "New Contact", (Array:1))
      #11 .../civicrm/CRM/Core/Invoke.php(86): CRM_Core_Invoke::runItem((Array:13))
      #12 .../civicrm/CRM/Core/Invoke.php(54): CRM_Core_Invoke::_invoke((Array:3))
      #13 .../civicrm/drupal/civicrm.module(489): CRM_Core_Invoke::invoke((Array:3))
      #14 [internal function](): civicrm_invoke("contact", "add")
      #15 /Users/davej/src/buildkit/build/d46/includes/menu.inc(527): call_user_func_array("civicrm_invoke", (Array:2))
      #16 /Users/davej/src/buildkit/build/d46/index.php(21): menu_execute_active_handler()
      #17

      {main}

        Attachments

          Activity

            People

            • Assignee:
              yashodha Yashodha Chaku
              Reporter:
              davej Dave Jenkins
            • Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: