- Модуль: rpa
- Путь к файлу: ~/bitrix/modules/rpa/lib/integration/bizproc/automation/factory.php
- Класс: BitrixRpaIntegrationBizprocAutomationFactory
- Вызов: Factory::onAfterStageDelete
static function onAfterStageDelete(int $typeId, int $stageId)
{
if (!static::canUseAutomation())
{
return;
}
$documentType = DocumentItem::makeComplexType($typeId);
$template = WorkflowTemplateTable::getList([
'filter' => [
'=MODULE_ID' => $documentType[0],
'=ENTITY' => $documentType[1],
'=DOCUMENT_TYPE' => $documentType[2],
'=DOCUMENT_STATUS' => $stageId,
],
'select' => ['ID']
])->fetch();
if ($template)
{
CBPDocument::DeleteWorkflowTemplate($template['ID'], $documentType, $errors);
}
}