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/ilovecveti.ru/bitrix/modules/bizproc/lib/service/ |
Upload File : |
<?php namespace Bitrix\Bizproc\Service; use Bitrix\Main\Config\Option; class RestrictedTracking extends \CBPTrackingService { private array $templateIdMap = []; private array $offTemplateMap = []; public function canWrite($type, $workflowId) { if (!$this->isForcedMode($workflowId) && $this->isOff($workflowId)) { return false; } return parent::canWrite($type, $workflowId); } private function isOff($workflowId): bool { $this->templateIdMap[$workflowId] ??= $this->getTemplateId($workflowId); $templateId = $this->templateIdMap[$workflowId]; $this->offTemplateMap[$templateId] ??= $this->isTemplateOff($templateId); return $this->offTemplateMap[$templateId]; } private function getTemplateId($workflowId): int { try { return \CBPRuntime::getRuntime()->getWorkflow($workflowId, true)->getTemplateId(); } catch (\Exception $e) { return 0; } } private function isTemplateOff(int $templateId): bool { $optionName = 'tpl_track_on_' . $templateId; $onTime = (int)Option::get('bizproc', $optionName, 0); if ($onTime > 0) { $sevenDays = 7 * 86400; return ($onTime + $sevenDays) <= time(); } return true; } }