Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/cvetdv.ru/bitrix/modules/bizproc/lib/Debugger/Mixins/ |
Upload File : |
<?php namespace Bitrix\Bizproc\Debugger\Mixins; trait WriterDebugTrack { protected function writeDebugTrack( string $workflowId, string $name, int $status, int $result, string $title = '', $toWrite = [], int $trackType = \CBPTrackingType::Debug ): ?int { /** @var $trackingService \Bitrix\Bizproc\Debugger\Services\TrackingService | null */ $trackingService = \CBPRuntime::GetRuntime(true)->getDebugService('TrackingService'); if ($trackingService && $trackingService->canWrite($trackType, $workflowId)) { return $trackingService->write($workflowId, $trackType, $name, $status, $result, $title, $toWrite); } return null; } protected function preparePropertyForWritingToTrack($value, string $name = ''): array { $toWrite = []; if ($name) { $toWrite['propertyName'] = $name; } $toWrite['propertyValue'] = $value; return $toWrite; } protected function writeSessionLegendTrack($workflowId): ?int { if (!$workflowId) { return null; } $debugSession = \Bitrix\Bizproc\Debugger\Session\Manager::getActiveSession(); if (!$debugSession) { return null; } return $this->writeDebugTrack( $workflowId, 'SESSION_LEGEND', \CBPActivityExecutionStatus::Closed, \CBPActivityExecutionResult::Succeeded, '', $debugSession->getShortDescription() ); } protected function writeDocumentStatusTrack($workflowId, array $status): ?int { if (!$workflowId) { return null; } $statusLog = [ 'STATUS_ID' => $status['STATUS_ID'], 'NAME' => $status['NAME'], 'COLOR' => $status['COLOR'], ]; return $this->writeDebugTrack( $workflowId, 'STATUS_CHANGED', \CBPActivityExecutionStatus::Closed, \CBPActivityExecutionResult::Succeeded, '', $statusLog, \CBPTrackingType::DebugAutomation ); } protected function writeAppliedTriggerTrack($workflowId, array $trigger): ?int { if (!$workflowId) { return null; } return $this->writeDebugTrack( $workflowId, 'TRIGGER_LOG', \CBPActivityExecutionStatus::Closed, \CBPActivityExecutionResult::Succeeded, $trigger['NAME'], $trigger['APPLIED_RULE_LOG'] ?? [], \CBPTrackingType::DebugAutomation ); } protected function writeDocumentCategoryTrack($workflowId, $categoryName): ?int { if (!$workflowId) { return null; } return $this->writeDebugTrack( $workflowId, 'CATEGORY_CHANGED', \CBPActivityExecutionStatus::Closed, \CBPActivityExecutionResult::Succeeded, '', $categoryName, \CBPTrackingType::DebugAutomation ); } }