+--------------------------------------------------------------------+
| CiviCRM version 4.6 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014 |
+ | Copyright CiviCRM LLC (c) 2004-2015 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2014
+ * @copyright CiviCRM LLC (c) 2004-2015
* $Id$
*
*/
}
$smartGroupInclude = "
-INSERT IGNORE INTO I_$job_id (email_id, contact_id)
+REPLACE INTO I_$job_id (email_id, contact_id)
SELECT civicrm_email.id as email_id, c.id as contact_id
FROM civicrm_contact c
INNER JOIN civicrm_email ON civicrm_email.contact_id = c.id
";
if ($mode == 'sms') {
$smartGroupInclude = "
-INSERT IGNORE INTO I_$job_id (phone_id, contact_id)
+REPLACE INTO I_$job_id (phone_id, contact_id)
SELECT p.id as phone_id, c.id as contact_id
FROM civicrm_contact c
INNER JOIN civicrm_phone p ON p.contact_id = c.id
$protos = '(https?|ftp)';
$letters = '\w';
- $gunk = '\{\}/#~:.?+=&;%@!\,\-';
+ $gunk = '\{\}/#~:.?+=&;%@!\,\-\|\(\)\*';
$punc = '.:?\-';
$any = "{$letters}{$gunk}{$punc}";
if ($onlyHrefs) {
);
$mailParams['toEmail'] = $email;
+ // Add job ID to mailParams for external email delivery service to utilise
+ $mailParams['job_id'] = $job_id;
+
CRM_Utils_Hook::alterMailParams($mailParams, 'civimail');
// CRM-10699 support custom email headers
if ($this->url_tracking) {
$data = CRM_Mailing_BAO_TrackableURL::getTrackerURL($token, $this->id, $event_queue_id);
if (!empty($html)) {
- $data = htmlentities($data);
+ $data = htmlentities($data, ENT_NOQUOTES);
}
}
else {
* @throws \Exception
*/
public static function create(&$params, $ids = array()) {
+ // WTH $ids
+ if (empty($ids) && isset($params['id'])) {
+ $ids['mailing_id'] = $ids['id'] = $params['id'];
+ }
// CRM-12430
// Do the below only for an insert
// Populate the recipients.
if (empty($params['_skip_evil_bao_auto_recipients_'])) {
- self::getRecipients($job->id, $mailing->id, NULL, NULL, TRUE, FALSE);
+ self::getRecipients($job->id, $mailing->id, NULL, NULL, TRUE, $mailing->dedupe_email);
}
}
return civicrm_api('MailingContact', 'getcount', $params);
}
+ /**
+ * Get a list of permissions required for CRUD'ing each field
+ * (when workflow is enabled).
+ *
+ * @return array
+ * Array (string $fieldName => string $permName)
+ */
+ public static function getWorkflowFieldPerms() {
+ $fieldNames = array_keys(CRM_Mailing_DAO_Mailing::fields());
+ $fieldPerms = array();
+ foreach ($fieldNames as $fieldName) {
+ if ($fieldName == 'id') {
+ $fieldPerms[$fieldName] = array(
+ array('access CiviMail', 'schedule mailings', 'approve mailings', 'create mailings'), // OR
+ );
+ }
+ elseif (in_array($fieldName, array('scheduled_date', 'scheduled_id'))) {
+ $fieldPerms[$fieldName] = array(
+ array('access CiviMail', 'schedule mailings'), // OR
+ );
+ }
+ elseif (in_array($fieldName, array('approval_date', 'approver_id', 'approval_status_id', 'approval_note'))) {
+ $fieldPerms[$fieldName] = array(
+ array('access CiviMail', 'approve mailings'), // OR
+ );
+ }
+ else {
+ $fieldPerms[$fieldName] = array(
+ array('access CiviMail', 'create mailings'), // OR
+ );
+ }
+ }
+ return $fieldPerms;
+ }
+
}