• Модуль: sender
  • Путь к файлу: ~/bitrix/modules/sender/lib/internals/countercalculation.php
  • Класс: Bitrix\Sender\Internals\CounterCalculation
  • Вызов: CounterCalculation::updateMailingSubscription
static function updateMailingSubscription()
{
	$dataDb = \Bitrix\Sender\PostingUnsubTable::getList(array(
		'select' => array(
			'CONTACT_ID' => 'POSTING_RECIPIENT.CONTACT_ID',
			'MAILING_ID' => 'POSTING.MAILING_ID',
		),
		'filter' => array(),
		'order' => array('ID' => 'ASC'),
	));
	while($data = $dataDb->fetch())
	{
		if(self::isTimeUp())
		{
			return true;
		}

		$primary = array('MAILING_ID' => $data['MAILING_ID'], 'CONTACT_ID' => $data['CONTACT_ID']);
		$fields = array('IS_UNSUB' => 'Y');
		$row = \Bitrix\Sender\MailingSubscriptionTable::getRowById($primary);
		if(!$row)
		{
			$result = \Bitrix\Sender\MailingSubscriptionTable::add($fields + $primary);
			$result->isSuccess();
		}
	}
	
	return false;
}