...Человеческий поиск в разработке...
- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_email.php
- Класс: \CCrmEMail
- Вызов: CCrmEMail::OnOutgoingMessageRead
static function OnOutgoingMessageRead($fields) { if (preg_match('/^(\d+)-[0-9a-z]+$/i', trim($fields['urn']), $matches)) { $activity = \CCrmActivity::getList( array(), array( 'ID' => $matches[1], '=%URN' => $matches[0], 'DIRECTION' => \CCrmActivityDirection::Outgoing, 'CHECK_PERMISSIONS' => 'N', ), false, false, array('ID', 'RESPONSIBLE_ID', 'SETTINGS', 'OWNER_TYPE_ID', 'OWNER_ID') )->fetch(); if (!empty($activity) and empty($activity['SETTINGS']['READ_CONFIRMED']) || $activity['SETTINGS']['READ_CONFIRMED'] <= 0) { \Bitrix\Crm\Timeline\EmailActivityStatuses\Entry::create([ 'ACTIVITY_ID' => $activity['ID'], 'AUTHOR_ID' => $activity['RESPONSIBLE_ID'], 'OWNER_TYPE_ID' => $activity['OWNER_TYPE_ID'], 'OWNER_ID' => $activity['OWNER_ID'], ]); $activity['SETTINGS']['READ_CONFIRMED'] = time(); \CCrmActivity::update($activity['ID'], array('SETTINGS' => $activity['SETTINGS']), false, false); if (\Bitrix\Main\Loader::includeModule('pull')) { //$datetimeFormat = \Bitrix\Main\Loader::includeModule('intranet') // ? \CIntranetUtils::getCurrentDatetimeFormat() : false; \Bitrix\Pull\Event::add($activity['RESPONSIBLE_ID'], array( 'module_id' => 'crm', 'command' => 'activity_email_read_confirmed', 'params' => array( 'ID' => $activity['ID'], 'READ_CONFIRMED' => $activity['SETTINGS']['READ_CONFIRMED'], //'READ_CONFIRMED_FORMATTED' => \CComponentUtil::getDateTimeFormatted( // $activity['SETTINGS']['READ_CONFIRMED']+\CTimeZone::getOffset(), // $datetimeFormat, // \CTimeZone::getOffset() //), ), )); } //Execute automation trigger - EmailReadTrigger $bindings = \CCrmActivity::GetBindings($activity['ID']); if ($bindings) { \Bitrix\Crm\Automation\Trigger\EmailReadTrigger::execute($bindings, $activity); } } } }