CBPDocument::onAfterTMDayStart: Bitrix method

      
<?php 
//  CBPDocument :: onAfterTMDayStart()
//  /dist/bitrix/modules/bizproc/classes/general/document.php:1451

    
public static function onAfterTMDayStart($data)
    {
        global 
$DB;

        if (!
CModule::IncludeModule("im"))
            return;

        
$userId = (int) $data['USER_ID'];

        
$iterator WorkflowInstanceTable::getList(
            array(
                
'select' => array(new \Bitrix\Main\Entity\ExpressionField('CNT''COUNT(\'x\')')),
                
'filter' => array(
                    
'=STARTED_BY' => $userId,
                    
'<OWNED_UNTIL' => date($DB->DateFormatToPHP(FORMAT_DATETIME),
                        
time() - WorkflowInstanceTable::LOCKED_TIME_INTERVAL)
                ),
            )
        );
        
$row $iterator->fetch();
        if (!empty(
$row['CNT']))
        {
            
$path IsModuleInstalled('bitrix24') ? '/bizproc/bizproc/?type=is_locked'
                
Main\Config\Option::get("bizproc""locked_wi_path"'/services/bp/instances.php?type=is_locked');

            
CIMNotify::Add(array(
                
'FROM_USER_ID' => 0,
                
'TO_USER_ID' => $userId,
                
"NOTIFY_TYPE" => IM_NOTIFY_SYSTEM,
                
"NOTIFY_MODULE" => "bizproc",
                
"NOTIFY_EVENT" => "wi_locked",
                
'TITLE' => GetMessage('BPCGDOC_WI_LOCKED_NOTICE_TITLE'),
                
'MESSAGE' =>     GetMessage('BPCGDOC_WI_LOCKED_NOTICE_MESSAGE', array(
                    
'#PATH#' => $path,
                    
'#CNT#' => $row['CNT']
                ))
            ));
        }
    }