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

MySQL error when adding contacts on a report to a group

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Trivial
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.7.14
    • Fix Version/s: 4.7.16
    • Component/s: CiviReport
    • Labels:
    • Versioning Impact:
      Patch (backwards-compatible bug fixes)
    • Documentation Required?:
      None
    • Funding Source:
      Contributed Code
    • Verified?:
      No

      Description

      After running the SYBUNT report, using the "Add Contacts to Group" button creates a MySQL error.
      Test on live site and demo site with same result.

      $Fatal Error Details = Array ( [callback] => Array ( [0] => CRM_Core_Error [1] => handle ) [code] => -2 [message] => DB Error: syntax error [mode] => 16 [debug_info] => SELECT DISTINCT contact_civireport.id AS addtogroup_contact_id, SQL_CALC_FOUND_ROWS contact_civireport.sort_name as civicrm_contact_sort_name, contact_civireport.id as civicrm_contact_id, email_civireport.email as civicrm_email_email, phone_civireport.phone as civicrm_phone_phone, contribution_civireport.contact_id as civicrm_contribution_contact_id, SUM(contribution_civireport.total_amount) as civicrm_contribution_total_amount, YEAR( contribution_civireport.receive_date ) as civicrm_contribution_receive_date FROM civicrm_contribution contribution_civireport INNER JOIN civicrm_contact contact_civireport ON contact_civireport.id = contribution_civireport.contact_id LEFT JOIN civicrm_email email_civireport ON contact_civireport.id = email_civireport.contact_id AND email_civireport.is_primary = 1 LEFT JOIN civicrm_phone phone_civireport ON contact_civireport.id = phone_civireport.contact_id AND phone_civireport.is_primary = 1 WHERE contribution_civireport.is_test = 0 AND contribution_civireport.contact_id NOT IN (SELECT distinct cont.id FROM civicrm_contact cont, civicrm_contribution contri WHERE cont.id = contri.contact_id AND YEAR( contri.receive_date ) = 2016 AND contri.is_test = 0 ) AND ( contribution_civireport.contribution_status_id IN (1) ) AND contact_civireport.is_deleted = 0 GROUP BY contribution_civireport.contact_id, YEAR( contribution_civireport.receive_date )

      [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 'SQL_CALC_FOUND_ROWS contact_civireport.sort_name as civicrm_contact_sort_name, c' at line 1]

        Attachments

          Activity

            People

            • Assignee:
              andrewhunt Andrew Hunt
              Reporter:
              TommyBobo Tommy Bobo
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: