CBPAllTaskService::onTaskChange: Bitrix method

      
<?php 
//  CBPAllTaskService :: onTaskChange()
//  /dist/bitrix/modules/bizproc/classes/general/taskservice.php:314

    
protected static function onTaskChange($taskId$taskData$status)
    {
        
$workflowId = isset($taskData['WORKFLOW_ID']) ? $taskData['WORKFLOW_ID'] : null;
        if (!
$workflowId)
        {
            
$iterator CBPTaskService::GetList(array('ID'=>'DESC'), array('ID' => $taskId), falsefalse, array('WORKFLOW_ID'));
            
$row $iterator->fetch();
            if (!
$row)
                return 
false;
            
$workflowId $row['WORKFLOW_ID'];
            
$taskData['WORKFLOW_ID'] = $workflowId;
        }

        
//clean counters cache
        
$users = array();
        if (!empty(
$taskData['USERS']))
            
$users $taskData['USERS'];
        if (!empty(
$taskData['USERS_REMOVED']))
            
$users array_merge($users$taskData['USERS_REMOVED']);
        if (!empty(
$taskData['USERS_STATUSES']))
            
$users array_merge($usersarray_keys($taskData['USERS_STATUSES']));
        
self::cleanCountersCache($users);

        
//ping document
        
$runtime CBPRuntime::GetRuntime();
        
$runtime->StartRuntime();
        
$documentId CBPStateService::GetStateDocumentId($workflowId);
        if (
$documentId)
        {
            
$documentService $runtime->GetService('DocumentService');
            try
            {
                
$documentService->onTaskChange($documentId$taskId$taskData$status);
            }
            catch (
Exception $e)
            {

            }
        }
        return 
true;
    }