- Модуль: crmmobile
- Путь к файлу: ~/bitrix/modules/crmmobile/lib/Kanban/ControllerStrategy/KanbanStrategy.php
- Класс: Bitrix\CrmMobile\Kanban\ControllerStrategy\KanbanStrategy
- Вызов: KanbanStrategy::prepareItemsResult
protected function prepareItemsResult(array &$items, Kanban $kanban): void
{
if ($this->entityTypeId !== \CCrmOwnerType::Lead)
{
return;
}
$kanban->getEntity()->appendMultiFieldData($items, $kanban->getAllowedFmTypes());
foreach ($items as &$item)
{
if (!empty($item['client']))
{
continue;
}
$contactTypes = ['phone', 'email', 'im'];
$hasContacts = false;
foreach ($contactTypes as $contactType)
{
if (!empty($item[$contactType]))
{
$hasContacts = true;
break;
}
}
if (!$hasContacts)
{
return;
}
$data = [
'title' => $item['name'],
'type' => strtolower($kanban->getEntity()->getTypeName()),
'hidden' => false,
'phone' => [],
'email' => [],
'im' => [],
];
foreach ($contactTypes as $contactType)
{
if (empty($item[$contactType]))
{
continue;
}
if (is_array($item[$contactType]))
{
foreach ($item[$contactType] as $contactItem)
{
$title = (
OpenLineManager::isImOpenLinesValue($contactItem['value'])
? OpenLineManager::getOpenLineTitle($contactItem['value'])
: ''
);
$data[$contactType][] = [
'value' => $contactItem['value'],
'complexName' => $contactItem['title'],
'title' => $title,
];
}
}
}
$item['client']['lead'] = [$data];
}
unset($item);
}