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

Fatal error on seach with Search profile selected under some circumstances

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Trivial
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.4.4
    • Fix Version/s: 4.5
    • Component/s: None
    • Labels:

      Description

      Reproduced on demo A Mysql error is hit when an advanced search is done using a location type as criteria when the results are viewed in a search profile that contains 'city' (Primary).

      The lines that pointed me to 'city' also suggested postal_code - which did indeed seem to be affected
      https://github.com/civicrm/civicrm-core/blob/master/CRM/Contact/BAO/Query.php#L4328

      video shows with postal_code - https://saucelabs.com/tests/9fb8086b8f464f5a98540700fb07e17d

      I suspect this notice is probably a clue!

      Notice: Undefined variable: addressJoin in CRM_Contact_BAO_Query->addHierarchicalElements() (line 1153 of /home/webeditor/jenkins-node/workspace/buildkit-demos.civicrm.org/build/d7-demo/sites/all/modules/civicrm/CRM/Contact/BAO/Query.php).

      DB Error: no such field
      Error Details
      Database Error Code: Unknown column '1-address.location_type_id' in 'on clause', 1054
      Additional Details:

      Array
      (
      [callback] => Array
      (
      [0] => CRM_Core_Error
      [1] => handle
      )

      [code] => -19
      [message] => DB Error: no such field
      [mode] => 16
      [debug_info] => SELECT DISTINCT UPPER(LEFT(contact_a.sort_name, 1)) as sort_name FROM civicrm_contact contact_a LEFT JOIN civicrm_address ON ( contact_a.id = civicrm_address.contact_id )
      LEFT JOIN civicrm_location_type `1-location_type` ON ( ( `1-address`.location_type_id = `1-location_type`.id ) ) WHERE ( civicrm_address.location_type_id IN (2) ) AND (contact_a.is_deleted = 0) ORDER BY UPPER(LEFT(contact_a.sort_name, 1)) asc [nativecode=1054 ** Unknown column '1-address.location_type_id' in 'on clause']
      [type] => DB_Error
      [user_info] => SELECT DISTINCT UPPER(LEFT(contact_a.sort_name, 1)) as sort_name FROM civicrm_contact contact_a LEFT JOIN civicrm_address ON ( contact_a.id = civicrm_address.contact_id )
      LEFT JOIN civicrm_location_type `1-location_type` ON ( ( `1-address`.location_type_id = `1-location_type`.id ) ) WHERE ( civicrm_address.location_type_id IN (2) ) AND (contact_a.is_deleted = 0) ORDER BY UPPER(LEFT(contact_a.sort_name, 1)) asc [nativecode=1054 ** Unknown column '1-address.location_type_id' in 'on clause']
      [to_string] => [db_error: message="DB Error: no such field" code=-19 mode=callback callback=CRM_Core_Error::handle prefix="" info="SELECT DISTINCT UPPER(LEFT(contact_a.sort_name, 1)) as sort_name FROM civicrm_contact contact_a LEFT JOIN civicrm_address ON ( contact_a.id = civicrm_address.contact_id )
      LEFT JOIN civicrm_location_type `1-location_type` ON ( ( `1-address`.location_type_id = `1-location_type`.id ) ) WHERE ( civicrm_address.location_type_id IN (2) ) AND (contact_a.is_deleted = 0) ORDER BY UPPER(LEFT(contact_a.sort_name, 1)) asc [nativecode=1054 ** Unknown column '1-address.location_type_id' in 'on clause']"]
      )

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                eileen Eileen McNaughton
                Reporter:
                eileen Eileen McNaughton
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: