CRM-19270 Can't search contact reference field on contribution form (by profile)

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Critical
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.7.10
    • Fix Version/s: 4.7.12
    • Component/s: None
    • Labels:
    • Documentation Required?:
      None
    • Funding Source:
      Contributed Code

      Description

      1. Create a new contact custom field group.
      2. Add a contact reference field under custom field group.
      3. Create new profile, adding contact reference
      4. Modify contribution form, selecting profile with contact reference
      5. Search for contact on front end form

      Have replicated on demo site.

        Attachments

          Activity

          [CRM-19270] Can't search contact reference field on contribution form (by profile)
          Adam Kwiatkowski added a comment -

          Aug 29 20:52:23 [info] $Fatal Error Details = Array
          (
          [message] => 8,4,6,5,7,10,12,11 is not of the type Int
          [code] =>
          )

          Aug 29 20:52:23 [info] $backTrace = #0 /public_html/sites/all/modules/civicrm/CRM/Core/Error.php(329): CRM_Core_Error::backtrace("backTrace", TRUE)
          #1 /public_html/sites/all/modules/civicrm/CRM/Utils/Type.php(310): CRM_Core_Error::fatal("8,4,6,5,7,10,12,11 is not of the type Int")
          #2 /public_html/sites/all/modules/civicrm/CRM/Contact/BAO/Query.php(5450): CRM_Utils_Type::escape("8,4,6,5,7,10,12,11", "Int")
          #3 /public_html/sites/all/modules/civicrm/CRM/Contact/BAO/Query.php(3021): CRM_Contact_BAO_Query::buildClause("id", "=", "8,4,6,5,7,10,12,11", "Int")
          #4 /public_html/sites/all/modules/civicrm/CRM/Contact/BAO/Query.php(2932): CRM_Contact_BAO_Query->addGroupContactCache("8,4,6,5,7,10,12,11", NULL, "contact_a", "=")
          #5 /public_html/sites/all/modules/civicrm/CRM/Contact/BAO/Query.php(1783): CRM_Contact_BAO_Query->group((Array:5))
          #6 /public_html/sites/all/modules/civicrm/CRM/Contact/BAO/Query.php(2010): CRM_Contact_BAO_Query->whereClauseSingle((Array:5), "Contact")
          #7 /public_html/sites/all/modules/civicrm/CRM/Contact/BAO/Query.php(501): CRM_Contact_BAO_Query->whereClause("Contact")
          #8 /public_html/sites/all/modules/civicrm/CRM/Contact/BAO/Query.php(465): CRM_Contact_BAO_Query->initialize("Contact")
          #9 /public_html/sites/all/modules/civicrm/CRM/Contact/BAO/Query.php(4312): CRM_Contact_BAO_Query->__construct((Array:6), (Array:4), NULL, TRUE, FALSE, 1, 1, TRUE, NULL, NULL, "AND", "Contact")
          #10 /public_html/sites/all/modules/civicrm/api/v3/utils.php(633): CRM_Contact_BAO_Query::apiQuery((Array:6), (Array:4), NULL, "sort_name", 0, "10", NULL, NULL, 1, 1, "Contact")
          #11 /public_html/sites/all/modules/civicrm/api/v3/Contact.php(164): _civicrm_api3_get_using_query_object("Contact", (Array:15), (Array:0))
          #12 /public_html/sites/all/modules/civicrm/Civi/API/Provider/MagicFunctionProvider.php(89): civicrm_api3_contact_get((Array:15))
          #13 /public_html/sites/all/modules/civicrm/Civi/API/Kernel.php(96): Civi\API\Provider\MagicFunctionProvider->invoke((Array:9))
          #14 /public_html/sites/all/modules/civicrm/api/api.php(23): Civi\API\Kernel->run("Contact", "Get", (Array:14), NULL)
          #15 /public_html/sites/all/modules/civicrm/CRM/Contact/Page/AJAX.php(135): civicrm_api("Contact", "Get", (Array:14))
          #16 [internal function](): CRM_Contact_Page_AJAX::contactReference()
          #17 /public_html/sites/all/modules/civicrm/CRM/Core/Invoke.php(278): call_user_func((Array:2))
          #18 /public_html/sites/all/modules/civicrm/CRM/Core/Invoke.php(86): CRM_Core_Invoke::runItem((Array:12))
          #19 /public_html/sites/all/modules/civicrm/CRM/Core/Invoke.php(54): CRM_Core_Invoke::_invoke((Array:3))
          #20 /public_html/sites/all/modules/civicrm/drupal/civicrm.module(448): CRM_Core_Invoke::invoke((Array:3))
          #21 [internal function](): civicrm_invoke("ajax", "contactref")
          #22 /public_html/includes/menu.inc(527): call_user_func_array("civicrm_invoke", (Array:2))
          #23 /public_html/index.php(21): menu_execute_active_handler()
          #24

          {main}
          Jitendra Purohit added a comment -

          Adam Kwiatkowski The contact reference field works fine and loads a correct list of contacts for me on dmaster as well as on local. Make sure you have correct permission (access contact reference fields) set for the user. The screenshot you shared loads the profile for anonymous user which doesn't have this permission.

          I've submitted a PR https://github.com/civicrm/civicrm-core/pull/8954 which restricts showing reference field for contacts not having the required permission.

          jacob added a comment - - edited

          i run the a cloned version from github i got this error:

          User warning: The following module is missing from the file system: civicrmtheme. In order to fix this, put the module back in its original location. For more information, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1128 of D:\xampp\htdocs\d\includes\bootstrap.inc).

          Jitendra Purohit added a comment -

          Adam Kwiatkowski This replicates for the contact reference field which is being restricted to more than one group. Modify Step 2 mentioned in the description to reproduce this.

          • Add a contact reference field under custom field group selecting at least 2 groups in "Limit List to Group" field.

          Updated the PR https://github.com/civicrm/civicrm-core/pull/8954 to fix the same.

          Monish Deb added a comment -

          Tested working fine

            People

            • Assignee:
              Monish Deb
              Reporter:
              Adam Kwiatkowski

              Dates

              • Created:
                Updated:
                Resolved: