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

Custom Search for Individuals Email IS (NOT) NULL returns error

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Fixed/Completed
    • Affects Version/s: 3.2.1
    • Fix Version/s: 3.2.2
    • Component/s: Core CiviCRM
    • Labels:
      None

      Description

      When you do a custom search as follows:

      Individual -> Email -> IS NOT NULL

      or

      Individual -> Email -> IS NULL

      you get a 'DB Error: syntax error' error. This has been tested on the demo for 3.2.1.

      Error details:

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

      [code] => -2
      [message] => DB Error: syntax error
      [mode] => 16
      [debug_info] => SELECT DISTINCT UPPER(LEFT(contact_a.sort_name, 1)) as sort_name FROM civicrm_contact contact_a LEFT JOIN civicrm_email ON (contact_a.id = civicrm_email.contact_id AND civicrm_email.is_primary = 1) WHERE ( ( ( civicrm_email.email IS NULL '' ) AND contact_a.contact_type IN ('Individual') ) ) AND (contact_a.is_deleted = 0) [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''' ) AND contact_a.contact_type IN ('Individual') ) ) AND (contact_a.is_delete' at line 1]
      [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_email ON (contact_a.id = civicrm_email.contact_id AND civicrm_email.is_primary = 1) WHERE ( ( ( civicrm_email.email IS NULL '' ) AND contact_a.contact_type IN ('Individual') ) ) AND (contact_a.is_deleted = 0) [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''' ) AND contact_a.contact_type IN ('Individual') ) ) AND (contact_a.is_delete' at line 1]
      [to_string] => [db_error: message="DB Error: syntax error" code=-2 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_email ON (contact_a.id = civicrm_email.contact_id AND civicrm_email.is_primary = 1) WHERE ( ( ( civicrm_email.email IS NULL '' ) AND contact_a.contact_type IN ('Individual') ) ) AND (contact_a.is_deleted = 0) [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''' ) AND contact_a.contact_type IN ('Individual') ) ) AND (contact_a.is_delete' at line 1]"]
      )

        Attachments

          Activity

            People

            • Assignee:
              kurund Kurund Jalmi
              Reporter:
              vshura Sean Boland
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: