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

Deleting/renaming "Bulk Email" activity type causes CRM_Core_Error in getActivities output

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Trivial
    • Resolution: Fixed/Completed
    • Affects Version/s: 3.1.1
    • Fix Version/s: 3.1.3
    • Component/s: Core CiviCRM
    • Labels:
      None

      Description

      End-user renamed the activity type "Bulk Email" to "Email" (for no good reason). This throws CRM_Core_Error SQL error below on any screen outputting activity type.

      This appears to be caused by lack of error checking on line 565 of CRM_Activity_BAO_Activity

      $bulkActivityTypeID = CRM_Core_OptionGroup::getValue( 'activity_type',
      'Bulk Email',
      'name' );

      and its subsequent use - lines 661 and 681 have uses like:

      AND {$activityTempTable}.activity_type_id <> {$bulkActivityTypeID} )

      where bulkActivityTypeID has no value.

      Renaming the activity back to "Bulk Email" or creating a new activity with this name resolve the issue.

      SQL ERROR:

      Sorry. A non-recoverable error has occurred.
      DB Error: syntax error

      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 ') INNER JOIN civicrm_contact c ON c.id = at.target_contact_id' at line 7, 1064

      Error Details:

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

      [code] => -2
      [message] => DB Error: syntax error
      [mode] => 16
      [debug_info] => INSERT INTO civicrm_temp_target_contact_52bce02d72485260974bc9be8a2569f7 ( activity_id, target_contact_id, target_contact_name )
      SELECT at.activity_id,
      at.target_contact_id ,
      c.sort_name
      FROM civicrm_activity_target at
      INNER JOIN civicrm_temp_activity_details_52bce02d72485260974bc9be8a2569f7 ON ( at.activity_id = civicrm_temp_activity_details_52bce02d72485260974bc9be8a2569f7.activity_id
      AND civicrm_temp_activity_details_52bce02d72485260974bc9be8a2569f7.activity_type_id <> )
      INNER JOIN civicrm_contact c ON c.id = at.target_contact_id [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 ')
      INNER JOIN civicrm_contact c ON c.id = at.target_contact_id' at line 7]
      [type] => DB_Error
      [user_info] => INSERT INTO civicrm_temp_target_contact_52bce02d72485260974bc9be8a2569f7 ( activity_id, target_contact_id, target_contact_name )
      SELECT at.activity_id,
      at.target_contact_id ,
      c.sort_name
      FROM civicrm_activity_target at
      INNER JOIN civicrm_temp_activity_details_52bce02d72485260974bc9be8a2569f7 ON ( at.activity_id = civicrm_temp_activity_details_52bce02d72485260974bc9be8a2569f7.activity_id
      AND civicrm_temp_activity_details_52bce02d72485260974bc9be8a2569f7.activity_type_id <> )
      INNER JOIN civicrm_contact c ON c.id = at.target_contact_id [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 ')
      INNER JOIN civicrm_contact c ON c.id = at.target_contact_id' at line 7]
      [to_string] => [db_error: message="DB Error: syntax error" code=-2 mode=callback callback=CRM_Core_Error::handle prefix="" info="INSERT INTO civicrm_temp_target_contact_52bce02d72485260974bc9be8a2569f7 ( activity_id, target_contact_id, target_contact_name )
      SELECT at.activity_id,
      at.target_contact_id ,
      c.sort_name
      FROM civicrm_activity_target at
      INNER JOIN civicrm_temp_activity_details_52bce02d72485260974bc9be8a2569f7 ON ( at.activity_id = civicrm_temp_activity_details_52bce02d72485260974bc9be8a2569f7.activity_id
      AND civicrm_temp_activity_details_52bce02d72485260974bc9be8a2569f7.activity_type_id <> )
      INNER JOIN civicrm_contact c ON c.id = at.target_contact_id [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 ')
      INNER JOIN civicrm_contact c ON c.id = at.target_contact_id' at line 7]"]
      )

        Attachments

          Activity

            People

            • Assignee:
              sushant Sushant Paste
              Reporter:
              ptpittman Patrick Pittman
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 30 minutes
                30m
                Remaining:
                Remaining Estimate - 30 minutes
                30m
                Logged:
                Time Spent - Not Specified
                Not Specified