- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/lib/Service/Factory/SmartDocument.php
- Класс: Bitrix\Crm\Service\Factory\SmartDocument
- Вызов: SmartDocument::configureAddOperation
protected function configureAddOperation(Operation $operation): void
{
parent::configureAddOperation($operation);
$operation->addAction(
Operation::ACTION_AFTER_SAVE,
new class extends Operation\Action {
public function process(Item $item): Result
{
$provider = new \Bitrix\Crm\Activity\Provider\SignDocument();
$bindings = [[
'OWNER_TYPE_ID' => $item->getEntityTypeId(),
'OWNER_ID' => $item->getId(),
]];
$parent = $item->get('PARENT_ID_' . \CCrmOwnerType::Deal);
if ($parent)
{
$bindings[] = [
'OWNER_TYPE_ID' => \CCrmOwnerType::Deal,
'OWNER_ID' => $parent,
];
}
return $provider->createActivity(
\Bitrix\Crm\Activity\Provider\SignDocument::PROVIDER_TYPE_ID_SIGN,
[
'BINDINGS' => $bindings,
'ASSOCIATED_ENTITY_ID' => $item->getId(),
'SUBJECT' => $item->getHeading(),
'COMPLETED' => 'N',
'RESPONSIBLE_ID' => $item->getAssignedById(),
'START_TIME' => (new DateTime())
->add('+30 DAYS'),
]
);
}
}
);
}