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

CiviMail fails when INSERT into activity_target table fails.

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.2.7
    • Fix Version/s: 4.3.0
    • Component/s: CiviMail
    • Labels:
      None

      Description

      When sending a mass mailing via CiviMail, there is occasionally an SQL failure which causes the mass mailing to be listed indefinitely as in a "Running" status. This issue happens with any SQL error.

      In the last issue where this happened, the SQL failure was in the file "/CRM/Activity/BAO/Activity.php" at line number 477.

      The failure message was : "Duplicate entry '4756-17516' for key 'UI_activity_target_contact_id"

      Here is the original failing code fragment:

      while (!empty($values))

      { $input = array_splice($values, 0, CRM_Core_DAO::BULK_INSERT_COUNT); $str = implode(',', $input); $sql = "INSERT INTO civicrm_activity_target ( activity_id, target_contact_id ) VALUES $str;"; CRM_Core_DAO::executeQuery($sql); }

      I fixed the issue by changing the SQL statement as follows:
      $sql = "INSERT IGNORE INTO civicrm_activity_target ( activity_id, target_contact_id ) VALUES $str;";

      (This seems to be related to the existing issue at: issues.civicrm.org/jira/browse/CRM-7484 )

        Attachments

          Activity

            People

            • Assignee:
              lobo Donald A. Lobo
              Reporter:
              sgladstone Sarah Gladstone
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: