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

Duplicate check fails and throws errors if there is no content in a duplicate check field.

    Details

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

      Description

      Reproduced in 1.9 and the current 2.0 alpha sandbox.

      If the Duplicate Contact Rules include a field that is not used by any record, then Find Duplicate Contacts will fail and throw nasty looking errors on screen, such as:
      "Sorry. A non-recoverable error has occurred.

      Database Error Code: 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 'AS 'match' FROM civicrm_address param WHERE param.contact_id = 1' at line 1, 1064

      Return to home page.

      Error Details:

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

      [code] => -2
      [message] => DB Error: syntax error
      [mode] => 16
      [debug_info] => SELECT param. AS 'match' FROM civicrm_address param
      WHERE param.contact_id = 1 [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 'AS 'match' FROM civicrm_address param
      WHERE param.contact_id = 1' at line 1]
      [type] => DB_Error
      [user_info] => SELECT param. AS 'match' FROM civicrm_address param
      WHERE param.contact_id = 1 [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 'AS 'match' FROM civicrm_address param
      WHERE param.contact_id = 1' at line 1]
      [to_string] => [db_error: message="DB Error: syntax error" code=-2 mode=callback callback=CRM_Core_Error::handle prefix="" info="SELECT param. AS 'match' FROM civicrm_address param
      WHERE param.contact_id = 1 [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 'AS 'match' FROM civicrm_address param
      WHERE param.contact_id = 1' at line 1]"]
      )"

      To reproduce:
      1> Change the Duplicate Contact Rules to include a field that is empty for all records of the selected type. In the sandbox, it took a little looking, but apparently Supplemental Address 2 is unused for all Individual records.
      2> Do a Find Duplicate Contacts using the relevant rule-set.

      Ideally, CiviCRM would simply disregard fields that are totally empty during the check. Failing this, a meaningful, human-readable error suggesting that the rules include empty fields would save some confused CiviCRM administrators.

        Attachments

          Activity

            People

            • Assignee:
              sunil Sunil Pawar
              Reporter:
              bchoc Brian Choc
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: