<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.3 |
+ | CiviCRM version 4.4 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2013 |
+--------------------------------------------------------------------+
// other emails, this job might have changed under us
// lets get the job status again and check
$job->status = CRM_Core_DAO::getFieldValue(
- 'CRM_Mailing_DAO_Job',
+ 'CRM_Mailing_DAO_MailingJob',
$job->id,
'status',
'id',
// changed between the first query and now
// to avoid race conditions
$job->status = CRM_Core_DAO::getFieldValue(
- 'CRM_Mailing_DAO_Job',
+ 'CRM_Mailing_DAO_MailingJob',
$job->id,
'status',
'id',
);
// create one child job if the mailing size is less than the offset
- // probably use a CRM_Mailing_DAO_Job( );
+ // probably use a CRM_Mailing_DAO_MailingJob( );
if (empty($offset) ||
$recipient_count <= $offset
) {
$fields = array();
if (!empty($testParams)) {
- $mailing->from_name = ts(
- 'CiviCRM Test Mailer (%1)',
- array(1 => $mailing->from_name)
- );
- $mailing->subject = ts('Test Mailing:') . ' ' . $mailing->subject;
+ $mailing->subject = ts('[CiviMail Draft]') . ' ' . $mailing->subject;
}
CRM_Mailing_BAO_Mailing::tokenReplace($mailing);
// to avoid making too many DB calls for this rare case
// lets do it when we snapshot
$status = CRM_Core_DAO::getFieldValue(
- 'CRM_Mailing_DAO_Job',
+ 'CRM_Mailing_DAO_MailingJob',
$this->id,
'status',
'id',
// CRM-9519
if (CRM_Core_BAO_Email::isMultipleBulkMail()) {
+ static $targetRecordID = NULL;
+ if (!$targetRecordID) {
+ $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
+ $targetRecordID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
+ }
+
// make sure we don't attempt to duplicate the target activity
foreach ($activity['target_contact_id'] as $key => $targetID) {
- $sql = "SELECT id FROM civicrm_activity_target WHERE activity_id = $activityID AND target_contact_id = $targetID;";
+ $sql = "
+SELECT id
+FROM civicrm_activity_contact
+WHERE activity_id = $activityID
+AND contact_id = $targetID
+AND record_type_id = $targetRecordID
+";
if (CRM_Core_DAO::singleValueQuery($sql)) {
unset($activity['target_contact_id'][$key]);
}