- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/lib/integration/socialnetwork/livefeed/crmcontact.php
- Класс: Bitrix\Crm\Integration\Socialnetwork\Livefeed\CrmContact
- Вызов: CrmContact::initSourceFields
public function initSourceFields()
{
$entityId = $this->getEntityId();
$logId = $this->getLogId();
$fields = [];
if ($entityId > 0)
{
$fields = array(
'ID' => $entityId,
'CURRENT_ENTITY' => $this->getCurrentEntityFields()
);
}
if ($logId > 0)
{
$res = LogTable::getList(array(
'filter' => array(
'=ID' => $logId
)
));
$logEntry = $res->fetch();
if (
!empty($logEntry['PARAMS'])
&& !empty($fields['CURRENT_ENTITY'])
) // not-message
{
$logEntry['PARAMS'] = unserialize($logEntry['PARAMS'], [ 'allowed_classes' => false ]);
if (is_array($logEntry['PARAMS']))
{
$this->setCrmEntitySourceTitle($fields['CURRENT_ENTITY']);
$fields = array_merge($fields, $logEntry['PARAMS']);
$sourceDescription = Integration\Socialnetwork::buildAuxTaskDescription(
$logEntry['PARAMS'],
$this->getLogEntityType()
);
if (!empty($sourceDescription))
{
$this->setSourceDescription(Loc::getMessage('CRMINTEGRATION_SONETLF_ENTITY_DESCRIPTION', array(
'#LOGENTRY_TITLE#' => $logEntry['TITLE'],
'#ENTITY_TITLE#' => $sourceDescription
)));
}
}
}
elseif ($logEntry['EVENT_ID'] === $this->getLogCommentEventId())
{
$this->setSourceDescription($logEntry['MESSAGE']);
$this->setSourceTitle(truncateText(($logEntry['TITLE'] !== '__EMPTY__' ? $logEntry['TITLE'] : $logEntry['MESSAGE']), 100));
}
}
$this->setSourceFields($fields);
}