CBPWorkflow :: OnRuntimeStopped: Bitrix method

      
<?php 
//  CBPWorkflow :: OnRuntimeStopped()
//  /dist/bitrix/modules/bizproc/classes/general/workflow.php:158

    
public function OnRuntimeStopped()
    {
        
$workflowStatus $this->GetWorkflowStatus();

        if (
$workflowStatus == CBPWorkflowStatus::Suspended)
            return;

        if (
$this->rootActivity->executionStatus == CBPActivityExecutionStatus::Closed)
        {
            
$this->SetWorkflowStatus(CBPWorkflowStatus::Completed);
        }
        else
        {
            
$workflowStatus $this->GetWorkflowStatus();
            if (
$workflowStatus == CBPWorkflowStatus::Running)
                
$this->SetWorkflowStatus(CBPWorkflowStatus::Suspended);
        }

        
$persister CBPWorkflowPersister::GetPersister();
        
$persister->SaveWorkflow($this->rootActivitytrue);
    }