- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/lib/integration/socialnetwork/livefeed/crmdeal.php
- Класс: Bitrix\Crm\Integration\Socialnetwork\Livefeed\CrmDeal
- Вызов: CrmDeal::initSourceFields
public function initSourceFields()
{
$entityId = $this->getEntityId();
$logId = $this->getLogId();
$fields = [];
if ($entityId > 0)
{
$fields = [
'ID' => $entityId,
'CURRENT_ENTITY' => $this->getCurrentEntityFields()
];
}
if ($logId > 0)
{
$res = LogTable::getList([
'filter' => [
'=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 = Socialnetwork::buildAuxTaskDescription(
$logEntry['PARAMS'],
$this->getLogEntityType()
);
if (!empty($sourceDescription))
{
$title = $logEntry['TITLE'];
if ($title === self::EMPTY_TITLE)
{
$title = self::getEventTitle([
'EVENT_ID' => $logEntry['EVENT_ID'],
]);
}
$this->setSourceDescription(Loc::getMessage('CRMINTEGRATION_SONETLF_ENTITY_DESCRIPTION', [
'#LOGENTRY_TITLE#' => $title,
'#ENTITY_TITLE#' => $sourceDescription,
]));
}
}
}
elseif ($logEntry['EVENT_ID'] === $this->getLogCommentEventId())
{
$this->setSourceDescription($logEntry['MESSAGE']);
$this->setSourceTitle(truncateText(($logEntry['TITLE'] !== self::EMPTY_TITLE ? $logEntry['TITLE'] : $logEntry['MESSAGE']), 100));
}
}
$this->setSourceFields($fields);
}