/** * Change status of recipients and mailing chain for resending mails to recipients who have error sending * * @param $id * @return void */ public static function prepareReSendErrorRecipients($id) { if (!static::canReSendErrorRecipients($id)) { return; } $mailingChain = static::getRowById(array('ID' => $id)); $updateSql = 'UPDATE ' . PostingRecipientTable::getTableName() . " SET STATUS='" . PostingRecipientTable::SEND_RESULT_NONE . "'" . " WHERE POSTING_ID=" . intval($mailingChain['POSTING_ID']) . " AND STATUS='" . PostingRecipientTable::SEND_RESULT_ERROR . "'"; \Bitrix\Main\Application::getConnection()->query($updateSql); PostingTable::update(array('ID' => $mailingChain['POSTING_ID']), array('STATUS' => PostingTable::STATUS_PART)); static::update(array('ID' => $id), array('STATUS' => static::STATUS_SEND)); }