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

Fatal DB Error: syntax accessing Cases tab in contact summary

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.1.0
    • Fix Version/s: 4.1.0
    • Component/s: CiviCase
    • Labels:
      None

      Description

      Go to "view contact" who has case(s). Click Cases tab:

      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 'DISTINCT ( civicrm_case.id ) IN ( 1 ) GROUP BY civicrm_case.id'

      Note that there's two instances of DISTINCT in the current query:

      "SELECT DISTINCT ( civicrm_case.id )..." at the beginning and at the end in the WHERE clause
      "WHERE ( contact_a.id = 105 AND civicrm_case.is_deleted = 0 ) AND (contact_a.is_deleted = 0) AND DISTINCT ( civicrm_case.id ) IN ( 1 ) GROUP BY civicrm_case.id"

      Removing line 175 from CRM/Case/Selector/Search.php resolves the error - but not sure that's the right fix:

      $this->_query->_distinctComponentClause = " DISTINCT ( civicrm_case.id )";

        Attachments

          Activity

            People

            • Assignee:
              lobo Donald A. Lobo
              Reporter:
              dgg David Greenberg
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: