<?php
// CBPDocument :: sendB24LimitsNotifyToAdmins()
// /dist/bitrix/modules/bizproc/classes/general/document.php:1497
public static function sendB24LimitsNotifyToAdmins($ts = 0)
{
if (time() > strtotime('2017-05-24'))
return '';
if ($ts > 0 && $ts > time())
return '\CBPDocument::sendB24LimitsNotifyToAdmins('.(int)$ts.');';
if (!CModule::IncludeModule('bitrix24') || !CModule::IncludeModule("im"))
return '';
$userIds = \CBitrix24::getAllAdminId();
if (!$userIds)
return '';
global $DB;
$dbResult = $DB->Query('SELECT COUNT(WS.ID) CNT
FROM b_bp_workflow_state WS
INNER JOIN b_bp_workflow_instance WI ON (WS.ID = WI.ID)
INNER JOIN b_bp_workflow_template WT ON (WS.WORKFLOW_TEMPLATE_ID = WT.ID)
WHERE WT.AUTO_EXECUTE <> '.(int)CBPDocumentEventType::Automation.'
GROUP BY WS.MODULE_ID, WS.ENTITY, WS.DOCUMENT_ID
HAVING CNT > 2
LIMIT 1');
$result = $dbResult->Fetch();
if (!empty($result))
{
foreach ($userIds as $userId)
{
CIMNotify::Add(array(
'FROM_USER_ID' => 0,
'TO_USER_ID' => $userId,
'NOTIFY_TYPE' => IM_NOTIFY_SYSTEM,
'NOTIFY_MODULE' => 'bizproc',
'NOTIFY_EVENT' => 'wi_limits',
'TITLE' => GetMessage('BPCGDOC_WI_LOCKED_NOTICE_TITLE'),
'MESSAGE' => GetMessage('BPCGDOC_WI_B24_LIMITS_MESSAGE')
));
}
}
$days = 3600*24*3;
return '\CBPDocument::sendB24LimitsNotifyToAdmins('.(time() + $days).');';
}