- Модуль: bizproc
- Путь к файлу: ~/bitrix/modules/bizproc/classes/general/document.php
- Класс: CBPDocument
- Вызов: CBPDocument::terminateWorkflow
static function terminateWorkflow($workflowId, $documentId, &$arErrors, $stateTitle = '')
{
$arErrors = array();
$runtime = CBPRuntime::GetRuntime();
try
{
$workflow = $runtime->GetWorkflow($workflowId, true);
if ($documentId)
{
$d = $workflow->GetDocumentId();
if ($d[0] != $documentId[0] || $d[1] != $documentId[1] || mb_strtolower($d[2]) !== mb_strtolower($documentId[2]))
throw new Exception(GetMessage("BPCGDOC_INVALID_WF"));
}
$workflow->Terminate(null, $stateTitle);
}
catch(Exception $e)
{
$arErrors[] = array(
"code" => $e->getCode(),
"message" => $e->getMessage(),
"file" => $e->getFile()." [".$e->getLine()."]"
);
return false;
}
return true;
}