X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FMailing%2FBAO%2FMailingJob.php;h=4f98ac1e95d7702f69d73b7047948ab40e358725;hb=0479b4c8095005abb475f17c243d9ea4613db58c;hp=22524f715262a89ae3c728064e7c7d7b7287a563;hpb=9c41996008a0cb938cd30d8996cdec462c6a61a7;p=civicrm-core.git diff --git a/CRM/Mailing/BAO/MailingJob.php b/CRM/Mailing/BAO/MailingJob.php index 22524f7152..4f98ac1e95 100644 --- a/CRM/Mailing/BAO/MailingJob.php +++ b/CRM/Mailing/BAO/MailingJob.php @@ -1,7 +1,7 @@ id . " AND $edTable.id IS null AND $ebTable.id IS null - AND $contactTable.is_opt_out = 0"; + AND ( $contactTable.is_opt_out = 0 + OR $contactTable.do_not_sms = 0 )"; } $eq->query($query); - static $config = NULL; - static $mailsProcessed = 0; + $config = NULL; if ($config == NULL) { $config = CRM_Core_Config::singleton(); @@ -570,7 +578,7 @@ VALUES (%1, %2, %3, %4, %5, %6, %7) if ( $config->mailerBatchLimit > 0 && - $mailsProcessed >= $config->mailerBatchLimit + self::$mailsProcessed >= $config->mailerBatchLimit ) { if (!empty($fields)) { $this->deliverGroup($fields, $mailing, $mailer, $job_date, $attachments); @@ -578,7 +586,7 @@ VALUES (%1, %2, %3, %4, %5, %6, %7) $eq->free(); return FALSE; } - $mailsProcessed++; + self::$mailsProcessed++; $fields[] = array( 'id' => $eq->id, @@ -627,6 +635,15 @@ VALUES (%1, %2, %3, %4, %5, %6, %7) $params = $targetParams = $deliveredParams = array(); $count = 0; + /** + * CRM-15702: Sending bulk sms to contacts without e-mail addres fails. + * Solution is to skip checking for on hold + */ + $skipOnHold = true; //do include a statement to check wether e-mail address is on hold + if ($mailing->sms_provider_id) { + $skipOnHold = false; //do not include a statement to check wether e-mail address is on hold + } + foreach ($fields as $key => $field) { $params[] = $field['contact_id']; } @@ -634,7 +651,7 @@ VALUES (%1, %2, %3, %4, %5, %6, %7) $details = CRM_Utils_Token::getTokenDetails( $params, $returnProperties, - TRUE, TRUE, NULL, + $skipOnHold, TRUE, NULL, $mailing->getFlattenedTokens(), get_class($this), $this->id @@ -800,9 +817,10 @@ VALUES (%1, %2, %3, %4, %5, %6, %7) } /** - * cancel a mailing + * Cancel a mailing * - * @param int $mailingId the id of the mailing to be canceled + * @param int $mailingId + * The id of the mailing to be canceled. * @static */ public static function cancel($mailingId) { @@ -848,10 +866,10 @@ AND status IN ( 'Scheduled', 'Running', 'Paused' ) /** * Return a translated status enum string * - * @param string $status The status enum + * @param string $status + * The status enum. * * @return string The translated version - * @access public * @static */ public static function status($status) { @@ -874,7 +892,6 @@ AND status IN ( 'Scheduled', 'Running', 'Paused' ) * to only process jobs that are approved. * * @return string For use in a WHERE clause - * @access public * @static */ public static function workflowClause() { @@ -893,8 +910,8 @@ AND status IN ( 'Scheduled', 'Running', 'Paused' ) } /** - * @param $deliveredParams - * @param $targetParams + * @param array $deliveredParams + * @param array $targetParams * @param $mailing * @param $job_date * @@ -1017,4 +1034,3 @@ AND record_type_id = $targetRecordID return $result; } } -